Re: selection of finder list view
Re: selection of finder list view
- Subject: Re: selection of finder list view
- From: Alex da Franca <email@hidden>
- Date: Sun, 21 Jan 2007 23:44:18 +0100
Am 21.01.2007 um 22:00 schrieb Luther Fuller:
Don't use System Events for this. I'm not sure what you want to do,
but run this script with an open list view window frontmost in the
Finder ...
tell application "Finder"
activate
set frontWindow to (some window whose index = 1)
set itemList to every item of frontWindow
repeat with anItem in itemList
select anItem
end repeat
end tell
... then rethink your solution.
Hi Luther,
many thanks for your answer.
sorry for not explaining better, what i am after, but I think System
Events is the only way for me to display the contextual menu for the
current selected finder item or am I missing something. (well at
least using applescript, of course)
as far as I understand your example it selects an item, but what I am
after is getting the currently selected item, better spoken: the row
INDEX of the currently selected item.
when I query the finder selection, it gives me the selected item, but
not the row, which I would need to address it via System Events
I have a bunch of additions in my contextual menus. I am just looking
for a way to avoid searching the mouse just to click on an item,
which I navigated to using the keyboard.
here's what i came up so far, which still is at the very beginning,
but as it is for personal use and I always use the finder in list
view, it does almost what I am after, with the exception, that it is
slow, if I try to invoke the contextual menu of an item, which is at
the bottom of a long list.
--------------------------------------------------
activate application "Finder"
tell application "System Events"
get system attribute "sysv"
if result is greater than or equal to 4144 then -- Mac OS X 10.3.0
if UI elements enabled then
tell application process "Finder"
tell the front window
tell splitter group 1
tell scroll area 2
tell outline 1
-- HERE I would like to query the selected rows to pick the
first one
repeat with i from 1 to the number of rows
tell row i
if selected then
tell group 1
repeat with n from 1 to the number of UI elements
tell UI element n
if (role = "AXFinderItem") then
perform action "AXShowMenu"
return
end if
end tell
end repeat
end tell
end if
end tell
end repeat
end tell
end tell
end tell
end tell
end tell
else
beep
display dialog "GUI Scripting is not enabled" & return & return &
"Open System Preferences and check Enable Access for Assistive
Devices in the Universal Access preference pane, then run this script
again." with icon stop
if button returned of result is "OK" then
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.universalaccess"
end tell
end if
end if
else
beep
display dialog "This computer cannot run this script" & return &
return & "The script uses GUI Scripting technology, which requires an
upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons
{"Quit"} default button "Quit"
end if
end tell
------------------------------------------------
Thanks for your time.
Best regards
------------------- Alexander da Franca ----------------
Multimedia Developer |_________________________| Lingo Programmer
------------------- <http://www.farbflash.de> ----------------
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/mailman//archives/applescript-users
This email sent to email@hidden