Let's say I want to click a button that appears somewhere within a window, using AppleScript.
click button works, but you have to know which button exactly you want to press.
For example: Scanning is a bit cumbersome when you always have to wait for the scanner to finish, then switch to Image Capture.app, then click Scan again.
So, I want to automate clicking this button here …
Well, I thought that would be relatively easy, but in the beginning this is as far as I got:
tell application "System Events" tell process "Image Capture" click button "Scan" of window "Image Capture" end tell end tell
Of course, the button is buried deeper than that (i.e. in some Split Group).
With the Accessibility Inspector I can see where it is, but do I really have to go down the UI element tree to find the button? Is there any shortcut? If not, what am I missing in
click button "Scan" of window "Image Capture"?
More general: Where do I find a button in the UI element hierarchy?