2016-01-21 43 views
0

我正在使用automator中的applescript來啓動快速記錄。當我運行從自動化時,AppleScript的,一切正常,但是當我運行相同的Automator序列作爲雙點擊應用,當它到達此行拋出一個錯誤*:使用automator設置快速時間窗口位置的滑稽問題

tell application "System Events" to tell process "QuickTime Player" to set position of front window to {1131, 725} 

任何想法爲什麼?

謝謝!

*的錯誤就是,「行動‘運行AppleScript’遇到錯誤」

回答

1

你可能會得到錯誤,因爲你的應用程序沒有權限訪問GUI腳本。

但是,您可以定位和調整在QuickTime Player窗口,沒有GUI的腳本是這樣的:

tell application "QuickTime Player" 
    tell window 1 
     set the bounds to {100, 100, 640, 480} 
    end tell 
end tell 

該所設定的範圍的4個數字是x位置,y位置,窗口寬度,窗口高度。因此,上面的腳本告訴第一個窗口將自己放置在遠離屏幕頂部100個像素,距離屏幕左邊100個像素處,並且要寬640個像素和480個像素高。

在QuickTime Player的AppleScript詞典中查找可讓您使用AppleScript開始錄製的命令。打開腳本編輯器應用程序並選擇文件>打開字典,然後選擇QuickTime Player。