问题
I'm a newbie in applescripting:
I've used UI Browser to find an element of a process I'd like to click. I've found that the element I wanna click is "UI element 10"
This is what I've come with:
tell application "System Events"
tell application process "nameofmyapp" to tell window 1
click UI element 10
end tell
end tell
But it returns: "missing value".
How can I solve this?
回答1:
System Events has problems sometimes clicking buttons, mostly on non-native cocoa application windows. Is that your situation?
Even if it's not, I wrote a command line tool that allows you to perform mouse clicks. You can find it here. You might want to try it. You have to click things by screen coordinates so you'll have to programmatically get the screen coordinates of the button from System Events, and then add some pixels to move the coordinates to the middle of the button, then click it with my tool. There's example applescript code on my web page to give you some help.
来源:https://stackoverflow.com/questions/12882361/clicking-an-ui-unknown-element-im-getting-missing-value