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: kai <email@hidden>
- Date: Sun, 1 Jan 2006 09:30:45 +0000
On 30 Dec 2005, at 00:14, Daniel Jalkut wrote:
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
Without your window switching workaround, it doesn't seem currently
possible using any direct approach, Daniel.
I understand that you're not keen on a UI scripting-based solution
for this. Nevertheless, just in case it might help in some other
situation, I'll throw the following suggestion into the pot. While
it's not entirely foolproof (only a file's displayed name can be
extracted via System Events' Processes Suite), it does avoid the need
to activate Finder and visibly diddle with windows.
The handler's relative complexity may be put down to the vagaries of
UI scripting, along with variations in the structure of Finder
windows - such as whether or not the toolbar is visible, icon/list/
column view options and, in the case of the latter, the existence (or
not) of a preview column.
Anyway, FWIW:
----------------
on selection_in_window(n)
tell application "System Events" to tell process "Finder"
set currentTarget to window n
tell currentTarget's splitter group 1 to if exists then set
currentTarget to it
tell currentTarget
tell browser 1 to if exists then tell scroll area 1's (last scroll
area ¬
where value of list 1's attribute "AXDescription" is "column")
if (count list 1's UI elements) is 0 then tell scroll area before
it to ¬
return name of list 1's UI elements whose selected is true
return name of list 1's UI elements whose selected is true
end tell
tell scroll area -1
tell outline 1 to if exists then return name of group 1's ¬
UI element 1 of (rows whose selected is true)
name of group 1's UI elements whose selected is true
end tell
end tell
end tell
end selection_in_window
tell application "Finder"
if (count Finder windows) < 2 then return {} (* or some error *)
Finder window 2's files whose displayed name is in my
selection_in_window(2)
end tell
----------------
A happy, healthy and peaceful new year to you all.
---
kai
_______________________________________________
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