10.7.4 OSX獅子 AppleScript的在UI腳本使用AXIdentifier爲AppleScript的
我運行一個應用程序(在建房子,也沒有AppleScript字典),有我想要複製到一個靜態文本元素剪貼板併發送到另一個應用程序,但我很難得到它的工作。
我用靶向元素的腳本是這樣的:
Tell application "System Events" to set frontmost of process "*application*" to true
Tell application "System Events"
Tell process "*application*"
Tell static text 1 of tab view 1 scroll area 1 of splitter group 1 of splitter group 1 of splitter group 1 of window 1
keystroke "a" using command down
delay 0.1
keystroke "c" using command down
delay 0.1
end tell
end tell
end tell
end tell
會發生什麼,是從錯誤的元素錯誤的文字是我每次在不同的點點擊時間複製到剪貼板該應用程序(有許多文本字段)。
我注意到在UI訪問器/輔助功能訪問器中,當您將鼠標放在應用程序上時,應用程序中的每個UI元素都有唯一的AXIdentifier值。
無論如何要完成我正在嘗試做的事情,使用AXIdentifier值來定位該元素並從中複製文本?
感謝所有幫助,這是我的第一篇文章,我希望它值得! 〜TheLarkInn
這就是我想知道的。我使用的是Accessibility Inspector,這是AXIdentifier的列表。我很好奇,如果這是曾經使用過。 –