Re: Selection of Finder's Second Window (Dave Lyons?)
Re: Selection of Finder's Second Window (Dave Lyons?)
- Subject: Re: Selection of Finder's Second Window (Dave Lyons?)
- From: deivy petrescu <email@hidden>
- Date: Thu, 29 Dec 2005 23:03:46 -0500
On Dec 29, 2005, at 19:14, Daniel Jalkut wrote:
This is probably a Dave Lyons question, but I will be happy to hear
an answer from anybody :)
good, I hope you don't mind!
I've used the Finder's "selection" property innumerable times to
write very useful scripts that operate on the selection in the
frontmost window.
Is there a way to ask the Finder what the selection is a window
other than the frontmost one? I was hoping for something like this:
items of window 2 whose selected is true
I was not aware one could have selections in two different windows.
Thanks for calling my attention
But I see there is no selected property of items. There is clearly
a selected state, because I can see the selection status of those
items in the secondary window. They will become "selection" when I
switch focus to that window.
The reason I want to do this is because I have an idea for a script
that will take a file from the front window and a file from the
second window and do a "FileMerge" on them.
A sick workaround is to temporarily switch the front window out to
get the second window's selection:
tell application "Finder"
set file1 to item 1 of (selection as list)
set index of window 2 to 1
set file2 to item 1 of (selection as list)
set index of window 2 to 1
display dialog (file1 as string) & "/" & (file2 as string)
end tell
Is there a cleaner way?
Thanks!
Daniel
I do not know if it is cleaner. But it works also from the script menu.
I wanted to bring a window of an application to the front. Once I
solved my problem, it solved your.
Here is the script. It requires UI scripting
<script>
property lista : ""
tell application "Finder" to activate
tell application "System Events"
tell process "Finder"
set w to windows
repeat with l in w
tell l to perform action "AXRaise"
set lista to my getsel(lista)
end repeat
end tell
display dialog lista
set lista to ""
end tell
on getsel(lista)
tell application "Finder" to set lista to lista & (selection as
Unicode text) & return
end getsel
</script>
I hope it is what you want.
Adjust it to your needs.
Deivy
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Applescript-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden