目前正在运行以从Java中的Applescript检索窗口的全部内容,如果我从java运行相同的脚本,applescript将返回不会发生的类对象,请提示如何格式化相同的脚本。
tell application "System Events"
tell process "Install Adobe Flash Player"
set tElements to entire contents of window 1
end tell
end tell
tElements
输出:
{button 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 2 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button 3 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of group 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player 11" of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", progress indicator 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text " " of group 3 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", image 1 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Error: General installation error" of group 4 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", button "Finish" of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events", static text "Adobe Flash Player Installer" of window "Adobe Flash Player Installer" of application process "Install Adobe Flash Player" of application "System Events"}
答案 0 :(得分:0)
你想要瞄准其中一个......哪一个?你不说。但通常您会获得其中一个对象的“值”。所以例如你会做这样的事情......
tell application "System Events"
tell process "Install Adobe Flash Player"
set theValue to value of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer"
end tell
end tell
如果“值”不起作用,那么您可以获取对象的属性并查看您想要的属性...
tell application "System Events"
tell process "Install Adobe Flash Player"
set theProperties to properties of group 2 of UI element 1 of scroll area 1 of window "Adobe Flash Player Installer"
end tell
end tell