如何使用苹果脚本在“后台”或“隐藏”应用程序中运行应用程序?

时间:2015-06-27 10:48:27

标签: applescript

我正在尝试启动并隐藏quicktime播放器,开始录制我的iPhone屏幕一段时间并使用以下脚本将文件名“hello”保存在桌面上

(N + 1) * D

要隐藏我尝试过的快速播放器:

  1. 告诉应用程序“系统事件”告诉进程“QuickTime Player”使用命令键击“h”。
  2. 告诉应用程序“Finder” 将进程“QuickTime Player”的可见性设置为false 结束告诉

  3. 告诉应用程序“系统事件” 将frontProcess设置为最前面为true的第一个进程 将frontProcess的可见设置为false 结束告诉

  4.   

    以上3种方法不符合我的目的,我不希望这个快速时间在我的屏幕上或在我的DOCK中可见......

2 个答案:

答案 0 :(得分:1)

将前窗的边界设置为“不可能”值并删除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

答案 1 :(得分:0)

tell application "System Events"
set visible of application process "QuickTime Player" to false
end tell
相关问题