メインメニュー項目を取得でき、システムイベントを使用して、ウィンドウ内の特定のボタンを選択してクリックすることができました。ポップアップシートに属するボタンの「ハンドル」を取得したいという問題が発生しています。たとえば、iTunesの「airplay」ボタン:
次のようなものを使用して、ボタンをクリックしてシートを開くことができます。
click button 10 of window "iTunes" of application process "iTunes" of application "System Events"
key code
手動で上下にスクロールすることもできますが、必要な特定のボタンを選択するための最も効率的でエレガントなソリューションを探しています(名前、この場合は「コンピューター」)。
アクセシビリティインスペクタを使用していますが、メニューに関する情報を取得できます。
<AXApplication: “iTunes”>
<AXWindow: “iTunes”>
<AXMenu>
<AXMenuItem: “AirPort Express”>
Attributes:
AXRole: “AXMenuItem”
AXRoleDescription: “menu item”
AXParent: “<AXMenu>”
AXEnabled: “1”
AXPosition: “x=1070 y=798”
AXSize: “w=146 h=22”
AXTitle: “AirPort Express”
AXHelp: “(null)”
AXSelected (W): “1”
AXMenuItemCmdChar: “(null)”
AXMenuItemCmdVirtualKey: “(null)”
AXMenuItemCmdGlyph: “(null)”
AXMenuItemCmdModifiers: “0”
AXMenuItemMarkChar: “(null)”
AXMenuItemPrimaryUIElement: “(null)”
Actions:
AXCancel - cancel
AXPress - press
では、これらのポップアップには特定のタイトルがありますか?好きselect button 1 of sheet 1 of...
これはおそらく簡単だと思います。私はこの問題について考えすぎています。
乾杯!bo
何を試しましたか:
--click menu item "Computer" of menu 1 of window "iTunes" of application process "iTunes"
--tell application "System Events" to tell process "iTunes"
-- tell menu 1 of menu bar item 1 of menu bar 2
-- click menu item "Copy"
-- end tell
--end tell
--click (every button whose value of attribute "AXTitle" is "Computer") of window "iTunes" of application process "iTunes"
--tell window 1
--click button "Computer" of tool bar 1 of window "iTunes" of application process "iTunes"
-- click button 1 of group 1 of group 1 of window "iTunes" of application process "iTunes"
--end tell
click (menu item 2 of every menu item whose attribute "AXRoleDescription" is "menu item") of window "iTunes" of application process "iTunes"
--click (button whose description is "menu item") of window "iTunes" of application process "iTunes"