Applescript 如何在“中运行应用程序”;背景“;或;隐藏“;使用apple脚本的应用程序?
我正在尝试启动并隐藏quicktime player,开始录制iPhone屏幕一段时间,并用下面的脚本将输出保存在桌面上,文件名为“hello”Applescript 如何在“中运行应用程序”;背景“;或;隐藏“;使用apple脚本的应用程序?,applescript,Applescript,我正在尝试启动并隐藏quicktime player,开始录制iPhone屏幕一段时间,并用下面的脚本将输出保存在桌面上,文件名为“hello” on run set filePath to (path to desktop as text) & "hello.mov" set f to a reference to file filePath startVideoRecording(f) end run on startVideoRecording(f)
on run
set filePath to (path to desktop as text) & "hello.mov"
set f to a reference to file filePath
startVideoRecording(f)
end run
on startVideoRecording(f)
tell application "QuickTime Player"
activate
tell application "System Events"
keystroke "h" using command down
end tell
set newMovieRecording to new movie recording
set camera to "Prabhu Konchada's iPhone"
tell newMovieRecording
set camera to "Prabhu Konchada's iPhone"
start
end tell
delay (10)
pause
save newMovieRecording in f
stop
close newMovieRecording
end tell
end startVideoRecording
要隐藏quicktime播放器,我尝试了:
将前窗口的边界设置为“不可能”值,并删除
activate
行
on run
set filePath to (path to desktop as text) & "hello.mov"
set f to a reference to file filePath
startVideoRecording(f)
end run
on startVideoRecording(f)
tell application "QuickTime Player"
set newMovieRecording to new movie recording
set bounds of window 1 to {-3000, 0, 100, 100}
set camera to "Prabhu Konchada's iPhone"
tell newMovieRecording
set camera to "Prabhu Konchada's iPhone"
start
end tell
delay (10)
pause
save newMovieRecording in f
stop
close newMovieRecording
end tell
end startVideoRecording
是的,当然你还需要运行中的
处理程序,我在帖子中省略了该处理程序。你可以在我使用运行中处理程序时编辑你的帖子吗。电影被录制并在10秒后显示在桌面上。可能问题出在camera
属性上,该属性在QT播放器字典中不存在。但是有一个当前摄像头
属性如何选择iPhone的摄像头?摄像头属性很好,对我来说确实有用。我不想让它遍布我的屏幕或在码头上。因此,您希望在后台运行此代码,或在应用程序开始录制后隐藏应用程序,而此代码可能会回答此问题,提供有关如何和/或为什么解决此问题的附加上下文将提高答案的长期价值。
tell application "System Events"
set visible of application process "QuickTime Player" to false
end tell