user interface - Apple Script to access elements of the Context Menu for a file -


i able context menu applescript tell perform action "axshowmenu"

tell application "system events" tell process "finder" tell window {window name} tell splitter group 1 tell splitter group 1 ui elements tell scroll area 1 ui elements tell group 1 ui elements tell image {filename} perform action "axshowmenu" end tell end tell end tell end tell end tell end tell 

this got menu up. not able access of menu items. how can access menu items file in finder?

you can use keystroke select menu item:

set filename "test.jpg" tell application "finder" activate delay 0.2 tell application "system events"     tell process "finder"         -- set thetarget value of attribute "axfocuseduielement"         set thetarget group 1 of scroll area 1 of splitter group 1 of splitter group 1 of window 1         tell thetarget             tell image filename perform action "axshowmenu"             delay 0.2             keystroke "open"             keystroke return         end tell     end tell end tell 

Comments