如何在命令行启动QuickTime录制?


Answers:


12

1)通过AppleScript编辑器创建一个Applescript并将其保存(例如QTRecord.scpt):

 tell application "QuickTime Player"
     activate
     start (new movie recording)
 end tell

2)打开终端并在命令行中运行脚本:

 osascript QTRecord.scpt 

或将整个事情作为一个单行代码:

 osascript -e 'tell application "QuickTime Player" to activate' -e 'tell application "QuickTime Player" to start (new movie recording)'

您怎么知道这些参数?苹果脚本编辑器的“记录”功能,请不要提供... @ohho
CodeFarmer 2016年

1
@CodeFarmer使用Xcode打开Quicktime Player X包的Contents文件夹内的QuickTImePlayerX.sdef。
詹姆斯·布什

2

根据此站点,可以使用Applescript来完成

tell application "QuickTime Player"

    set nr to (new movie recording)
    set nr to start recording true
    delay 10
    set nr to stop recording true
end tell

因此它与Quick-Time互动。QuickTime没有直接命令。


编译以上代码会产生语法错误:Expected end of line, etc. but found “true”.
ohho 2012年
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.