Re: System Events scripting of Finder window
Re: System Events scripting of Finder window
- Subject: Re: System Events scripting of Finder window
- From: David Marshall <email@hidden>
- Date: Sun, 18 Mar 2007 21:33:15 -0400
On Sun, 18 Mar 2007 06:50:51 -0400, Bill Cheeseman wrote:
AppleScript index numbers for menu items are shown correctly for
all menu
items at once in PreFab UI Browser. This includes Option-down
variants (and
their names), even when the Option key is not being held down.
Here's a "poor man's" script which approximates (crudely) this
functionality by looping through the menus of a chosen app,
sequentially representing each menu in "ASCII Art" style, along with
the associated index numbers for the individual menu items:
set theChoice to choose file of type {"APPL"} default location (path
to applications folder) without invisibles
set theApp to name of (info for theChoice)
tell application theApp to activate
tell application "System Events"
tell process theApp
set countMenus to count every menu of menu bar 1
repeat with i from 2 to (countMenus - 1) --exclude Apple Menu and
Help Menu
set theMenu to menu i of menu bar 1
set theName to name of theMenu
set theLimit to count every menu item of theMenu
set theseItems to {}
repeat with n from 1 to theLimit
if n < 10 then
set theNum to "0" & n as text --make 1- and 2-digit numbers
flush in output
else
set theNum to n as text
end if
try
set thisItem to name of menu item n of theMenu
set end of theseItems to theNum & " " & thisItem
set n to n + 1
on error --assume unnamed menu item is separator
set end of theseItems to theNum & " -----------"
set n to n + 1
end try
end repeat
set AppleScript's text item delimiters to return
display dialog theseItems as text with title theApp & ": " &
theName & " menu"
set AppleScript's text item delimiters to ""
set i to i + 1
end repeat
end tell
end tell
- - - - -
Dave
_______________________________________________
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/archives/applescript-users
This email sent to email@hidden