【AppleScript】画面サイズの取得方法

画面サイズを取得して、safari のブラウザサイズを設定。


global screenWidth
global screenHeight
-- 〜〜〜〜〜〜〜〜〜〜〜〜〜〜〜
tell application "Safari"
activate
tell window 1
open location "https://www.google.co.jp"
tell (do shell script "/usr/sbin/system_profiler SPDisplaysDataType | grep Resolution | tail -n 1") to set {screenWidth, screenHeight} to {word 2, word 4}
set bounds to {0,0, screenWidth, screenHeight}
end tell
end tell

返信を残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です

CAPTCHA