基本
- optionキーを押しながら「メニュー」→「ウィンドウ」→「ウインドウを整理」
tell application "Finder"
set screenSize to bounds of window of desktop
set screenWidth to item 3 of screenSize
end tell
tell application "System Events"
set myFrontMost to name of first item of ¬
(processes whose frontmost is true)
end tell
try
tell application myFrontMost
set windowSize to bounds of window 1
set windowXl to item 1 of windowSize
set windowYt to item 2 of windowSize
set windowXr to item 3 of windowSize
set windowYb to item 4 of windowSize
set windowWidth to windowXr - windowXl
set bounds of window 1 to {¬
(screenWidth - windowWidth) / 2.0, ¬
windowYt, ¬
(screenWidth + windowWidth) / 2.0, ¬
windowYb}
end tell
end try
- アプリケーション > ユーティリティ > スクリプトエディタ.app を起動
- スクリプトエディタ上でこれをコピペして任意の名前でスクリプトとして保存(例:Center-Window.scpt)
- ~/Library/Scripts に入れる
- スクリプトエディタ > 設定 > 一般 > メニューバーにスクリプトメニューを表示 をチェック
- メニューバー右上にスクリプトメニューのアイコンが表示されるので、任意のアプリを選んで「Center-Window」を選択
- 注:このスクリプトは水平方向のみ対応しています