サイトアイコン Dev-Dev

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

【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
モバイルバージョンを終了