I tried to use perform within the System Evenets application to script UI elements. I use get action of radio button and see there is action “AXPress”. Then I script as follows perform “AXPress” but I do not see anything happens. I also try to perform “AXMenuShow”, perform “AXConfirm” on test field, I do not see any operation either. Am I doing the right thing?
This works fine here (this will pick the refresh button of the toolbar with my current configuration in Safari):
tell application "System Events" tell process "Safari" perform action "AXPress" of button 1 of group 2 of tool bar 1 of window 1 end tell end tell
Some items will need be the frontmost process to work. Eg (this will choose the “about this mac” menu item in my Finder):
tell application "System Events" tell process "Finder" set frontmost to true perform action "AXPress" of menu item 1 of menu 1 of menu bar item "Finder" of menu bar 1 end tell end tell
I make it work now. The problem is that I need to use
perform action “AXPress” – this works fine.
perform “AXPress” – this does not work.
Thanks so much!