0

目前正在运行以从 Java 中的 Applescript 检索窗口的全部内容,applescript 正在返回类对象,如果我从 java 运行相同的脚本,则不会发生这种情况,请建议如何格式化。

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"}
4

1 回答 1

0

You want to target one of them... which one? You don't say. However normally you get the "value" of one of those objects. So for example you would do something like this...

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

And if the "value" doesn't work then you can get the properties of the object and see which property you want...

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
于 2012-10-26T14:03:00.090 回答