Clicking an UI unknown element: I'm getting “missing value”

那年仲夏 提交于 2019-12-25 05:22:43

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!