次のようなスクリプトを作成しようとしています。
- 特定のプログラムを開く
- プログラム ウィンドウ内の特定の場所にあるボタンをクリックします。
- クリック間の遅延を指定して、特定の回数だけクリックを繰り返します
iCal を使用してスクリプトの実行をスケジュールする予定ですが、実際のスクリプトはどのように表示されますか? ウィンドウを表示せずにバックグラウンドで実行できますか?
次のようなスクリプトを作成しようとしています。
iCal を使用してスクリプトの実行をスケジュールする予定ですが、実際のスクリプトはどのように表示されますか? ウィンドウを表示せずにバックグラウンドで実行できますか?
ほとんどのネイティブ アプリケーションは、次のような UI スクリプトをサポートしています。
reopen application "Finder" -- open a default window if there are no open windows
tell application "System Events" to tell process "Finder"
repeat 3 times
click button 2 of window 1
delay 1
end repeat
end tell
「補助デバイスへのアクセスが無効になっています」のようなエラーが表示された場合は、アクセシビリティ設定ペインから補助デバイスへのアクセスを有効にします。
Xcode がある場合は、Accessibility Inspector を使用して UI 要素を検査できます。または、次のようなものを使用します。
reopen application "Finder"
tell application "System Events" to tell process "Finder" to tell window 1
{class, value} of UI elements of UI elements
description of UI elements
properties of some UI element
attributes of some UI element
value of attribute "AXFocused" of some UI element
actions of button 2
end tell
click
うまくいかない場合は、 、 、または を試しperform action "AXPress"
てset selected to true
くださいset focused to true
。