Answers:
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)'
根据此站点,可以使用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”.