
Apple スクリプトが私に必要なものかどうかはわかりませんが、必要なことのほとんどを実行できるようです。代替案があれば遠慮なく提案してください。
カウントダウンビデオを開始するために、正確な時間にキャラクターをプログラムに送信する必要があります。私が持っているAppleスクリプトは
tell application "ProPresenter 5"
activate
end tell
tell application "System Events"
keystroke "z"
end tell
私が必要としているのは、ある日は10:40:25に開始し、次の日は10:40:15に開始できるようにすることです。私が見たガイドはすべてカレンダーやオートメーターを使用していますが、それらは1分単位です。また、約20分前に設定するだけで済みます。
関係があるなら、私はOS X 10.8.5を使用しています
答え1
これは、システム イベントがキーストロークを送信する時間を入力するダイアログを表示する、ちょっとした設定です。このスクリプトをアプリケーションとして保存して、いつでも実行できます。別の方法としては、コードの最初の 2 行を削除して、次の行に置き換えることもできます。property requested_time : "10:40:25 AM”
その後、スクリプトを iCal イベントに追加して、毎日任意の時間に起動するようにできます。
set requested_time to display dialog "Please Enter Your Start Time With The Following Format: Hour:Minutes:Seconds" default answer "10:40:25 AM" buttons {"OK"} default button 1
set requested_time to text returned of requested_time
set theTime to time string of (current date)
tell application "ProPresenter 5" to launch -- Opens The App Without Bringing It Up Upfront. Added This Line To Make Sure Your Application Is Running When System Events Sends The Keystroke. You Can Always Remove This Line If You Prefer
repeat until theTime is greater than or equal to requested_time -- Added The "Greater Than" Just As A Failsafe
delay 1
set theTime to time string of (current date)
end repeat
tell application "ProPresenter 5" to activate
delay .5 -- My system did not need this delay. Yours may not either, but I added it just in case.
tell application "System Events"
keystroke "z"
end tell
または、このバージョンのスクリプトをアプリとして保存することもできます。
property requested_time : "10:40:25 AM”
set theTime to time string of (current date)
tell application "ProPresenter 5" to launch -- Opens The App Without Bringing It Up Upfront. Added This Line To Make Sure Your Application Is Running When System Events Sends The Keystroke. You Can Always Remove This Line If You Prefer
repeat until theTime is greater than or equal to requested_time -- Added The "Greater Than" Just As A Failsafe
delay 1
set theTime to time string of (current date)
end repeat
tell application "ProPresenter 5" to activate
delay .5 -- My system did not need this delay. Yours may not either, but I added it just in case.
tell application "System Events"
keystroke "z"
end tell
次に、毎日繰り返す新しいカレンダーイベントを作成し、20分前にアプリとして保存したスクリプトを起動します。
答え2
AppleScriptdelay
コマンドを使用するだけで、スクリプトの実行を正確な分から何秒か遅らせることができます。
あなたの例によると、10:40:25 に実行したい場合は、スクリプトを 10:40:00 に実行するように設定しますが、コマンドはdelay 25
最初の行に配置します。