使用 AppleScript 确定 QuickTime 何时停止录制
Determining when QuickTime stops recording using AppleScript
我正在使用以下 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。
您可以将 new screen recording
命令的结果放入变量中。
使用exists命令检查此文档
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
我正在使用以下 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。
您可以将 new screen recording
命令的结果放入变量中。
使用exists命令检查此文档
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