我正在寻找使用Applescript控制Quicktime的解决方案。 我所需要做的只有以下几点: - 打开Quicktime并开始录制 - 停止录制并将文件保存到指定位置。
根据之前的帖子,我已经得到了以下内容。
set theFilePath to "/Users/jamestebb/Desktop/01TestRecords/ " & "myfile" & ".mov"
tell application "QuickTime Player"
set newMovieRecording to new movie recording
tell newMovieRecording
start
delay 5
pause
save newMovieRecording in POSIX file theFilePath
stop
close newMovieRecording
end
这很完美,但是针对这个项目,我需要单独的脚本提示来开始和结束录制,而不是等待/延迟。
我使用以下代码开始录制:
set theFilePath to "/Users/jamestebb/Desktop/01TestRecords/ " & "myfile" & ".mov"
tell application "QuickTime Player"
set newMovieRecording to new movie recording
tell newMovieRecording
start
end tell
end tell
这样做是没有问题的,然而当我尝试使用以下代码停止录制时,我会遇到“暂停”无法识别的错误。
set theFilePath to "/Users/jamestebb/Desktop/01TestRecords/ " & "myfile" & ".mov"
tell application "QuickTime Player"
set MovieRecording to new movie recording
tell MovieRecording
pause
save MovieRecording in POSIX file theFilePath
stop
close MovieRecording
end tell
end tell
我猜这是由于当前正在记录的文件不再是“新电影录制”所致。
有什么想法可以解决吗?