0

現在、Java で Applescript からウィンドウの内容全体を取得するために実行しています。Applescript は、Java から同じスクリプトを実行すると発生しないクラス オブジェクトを返します。pls は同じものをフォーマットする方法を提案します。

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

そのうちの 1 つをターゲットにしたい... どれを?本当なの。ただし、通常、これらのオブジェクトのいずれかの「値」を取得します。たとえば、このようなことをするでしょう...

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