views:

58

answers:

0

Hi all, I got trapped in clicking context menu item using Applescript.

Although UIElementInspector can get the hierarchies of the right click menu item, there is an error message "... Can't get menu 0 of ..." shown every time I run the Applescript.

The script would like:

tell application "Finder" to open POSIX file "/Users"
tell application "Finder" to activate
tell application "System Events"
    tell process "Finder"
        set ui to <any ui element that can perform an right click action and popup a menu>
        tell ui to perform action "AXShowMenu"
        click menu item 1 of menu 0 of ui
    end tell
end tell

Any help will be grateful.