我正在使用以下AppleScript来确定用户何时点击任务栏中的停止录制按钮:
tell application "QuickTime Player"
tell document 1
activate
new screen recording
delay 1
tell application "System Events" to key code 49
delay 2
repeat until (new screen recording) is false
end repeat
end tell
end tell
虽然脚本不断重新启动QuickTime。
答案 0 :(得分:1)
您可以将new screen recording
命令的结果放入变量。
使用存在命令检查此文档
tell application "QuickTime Player"
activate
set tdoc to new screen recording --> document "Screen Recording"
delay 1
tell application "System Events" to key code 49
delay 2
repeat while exists tdoc
delay 1
end repeat
-- the recording is stopped
tell front document
-- do something with the front document ("Untitled")
end tell
end tell