我正在尝试为我必须的项目编写一个小的 AppleScript:
- 开始录制 QuickTime 影片
- 最小化录制窗口
- 打开一部电影,将其自身置于全屏状态
- 电影播放完毕后,录制应停止
- 录音应以文件名“当前日期和时间”保存在背景中
- 关闭正在播放的电影
- 在 Safari 中打开一个网站。
到目前为止,这是我设法做到的:
set theDate to current date
set filePath to (path to desktop as text)
tell application "QuickTime Player"
activate
set newMovieRecording to new movie recording
tell newMovieRecording
start
tell application "QuickTime Player"
set miniaturized of window 1 to true
end tell
tell application "QuickTime Player"
open file "Users:test:Desktop:Movie.m4v"
tell document "Movie.m4v" to play
set the bounds of the first window to {0, 0, 1800, 1100} -- I did not find how to put the window in full screen (whatever the screen size is: I wrote this script on an external screen , but the project will take place on the screen of a laptop).
end tell
delay 160 -- the length of the movie
save newMovieRecording in file (filePath) & theDate
stop
close newMovieRecording
tell application "QuickTime Player"
close document "Movie.m4v"
end tell
end tell
end tell
tell application "Safari"
activate
open location "http://stackoverflow.com"
end tell
上面的脚本是我所能得到的:当电影录制应该保存自己时,我从 AppleScript 编辑器收到以下消息:“AppleScript 错误 - QuickTime 播放器出错:无效的密钥形式。”
提前感谢您的帮助。