2016-04-11 12 views
0

特定のポップダウンメニューの項目をクリックするのを自動化したいと思います。 たとえば、「Message receive Sound」の値を他の値に変更したいとします。 AppleScriptでどうすればいいですか? AppleScriptの他のポップダウンメニューでこれをどうやって行うことができますか? AppleScriptのポップアップメニューボタンの選択

は(画像に示されているIMessageが設定メニューを開くには、タイプCMD COMMA、あなた一度開いIMessageが)

注:私は正常私はただのAppleScriptでそれをやりたい、これのAutomatorを行っています。

enter image description here

答えて

1

これは、GUIスクリプトと呼ばれています。 UI要素への参照を特定する必要があります。

GUIスクリプトは、システムのバージョンによって大きく異なります。更新がUI構造を変更した場合、スクリプトはブレーキをかけます。

サウンドポップアップメニューで「ポップコーン」というサウンドを選択します。エルキャピタンのためです。システム< 10.11では、UI要素が異なる場合があり、プロセス名が「iChat」である可能性があります。

tell application "System Events" 
    tell process "Messages" 
     set frontmost to true 
     if not (exists (1st window whose value of attribute "AXIdentifier" is "MessagesPreferencesWindow")) then 
      keystroke "," using command down 
      repeat until exists (1st window whose value of attribute "AXIdentifier" is "MessagesPreferencesWindow") 
       delay 0.1 
      end repeat 
     end if 
     tell (1st window whose value of attribute "AXIdentifier" is "MessagesPreferencesWindow") 
      tell pop up button 4 of group 1 
       click 
       delay 0.2 
       click menu item "Popcorn" of menu 1 
      end tell 
     end tell 
    end tell 
end tell