如何在AppleScript中将quicktime文档当前相机更改为其他相机?我希望脚本自动切换到我的iPhone,然后录制视频。
我已经完成了它使用系统事件点击,但这种方式很慢而且很笨重。
tell application "QuickTime Player"
activate
tell application "System Events"
activate
tell process "QuickTime Player"
click menu item "New Movie Recording" of menu "File" of menu bar 1
set cameras to button 3 of window 1
click cameras
delay 0.5
click menu item 3 of menu 1 of cameras
end tell
end tell
delay 2
tell (document 0)
start
delay 3
stop
end tell
end tell
根据QuickTime Player脚本库,您可以使用以下命令检索视频录制设备列表:
get [id, name] of video recording devices
这将返回如下内容:
{{"CC26302Z3U5H0X0FP", "iGlasses"}, {"FaceTime Camera", "iGlasses"}}
分别对应每个摄像机的ID和名称。每个电影录制都有一堆属性,其中一个叫做当前摄像机,属于视频录制设备。理论上,该属性既可读又可设置。
因此,一个人应该这样做:
set R to new movie recording -- creates new recording
set current camera of R to video recording device named "iGlasses"
但是,这个命令绝对没有。实际上,当我尝试使用get current camera of R
读取属性的值时,它返回missing value
。
所以,我的感觉是这个功能还没有在AppleScript中正确实现,或者QuickTime Player中存在一个错误。
现在做一个快速谷歌显示很多人遇到了这个问题,其他人得到了与我相同的结论,例如here。
其他人的建议似乎都依赖于GUI脚本,我分享你的感受。
对不起,这不是你所希望的答案。