![見出し画像](https://assets.st-note.com/production/uploads/images/116874844/rectangle_large_type_2_ea2e7597499cc56f3c1d0cfa0e05e74e.png?width=800)
Photo by
zepgpz400
【MAC操作効率化】ウインドウを2枚並べるAppleScript
このスクリプトを使わない日はない。
Macの標準機能でもいいのではないかと個人的には思う。
Finderを操作していると、
ファイル/フォルダを別のフォルダに移動する、コピーする。
ファイルを別のフォルダにあるドロップレットにドロップする。
という操作をよくする。
⌘+Nで新しいウインドウを開いて、良い感じの大きさ、位置に調整するという動作をしながら、これは筋繊維の無駄遣いだと思った。
なので、クリックすると下図のようにウインドウが2枚並ぶスクリプトを作った。
![](https://assets.st-note.com/img/1695354325022-0dnHoN173x.jpg?width=800)
下図のようにウインドウのツールバーにセットしておくと使いやすい。
腱鞘炎の予防になれば良いなと思う。
![](https://assets.st-note.com/img/1695354855404-mswRqmtrs5.jpg?width=800)
script MyScript
tell application "Finder"
set window_count to count the Finder window
set screen_bounds to bounds of window of desktop
set screen_width to item 3 of screen_bounds
set screen_hight to item 4 of screen_bounds
set left_window_bounds to {30, (screen_hight / 7) div 1, (screen_width / 2) div 1 - 5, (screen_hight / 7) div 1 * 6}
set right_window_bounds to {(screen_width / 2) div 1 + 5, (screen_hight / 7) div 1, screen_width - 30, (screen_hight / 7) div 1 * 6}
set sidebar_width to 150
if window_count is greater than 1 then
tell Finder window 1
set the bounds to left_window_bounds
set the sidebar width to sidebar_width
end tell
tell Finder window 2
set the bounds to right_window_bounds
set the sidebar width to sidebar_width
end tell
else
if window_count is 0 then
set Finder_window1 to make new Finder window
end if
tell Finder window 1
set the bounds to left_window_bounds
set the sidebar width to sidebar_width
end tell
set Finder_window2 to make new Finder window
tell Finder_window2
set the bounds to right_window_bounds
set the sidebar width to sidebar_width
end tell
end if
tell application "System Events"
set frontmost of process "Finder" to true
end tell
end tell
end script
on run
local tempScript
copy MyScript to tempScript
run tempScript
end run
この記事が気に入ったらサポートをしてみませんか?