Skip to content

Instantly share code, notes, and snippets.

@zhanggang807
Forked from keflavich/resize_window.scpt
Created September 29, 2018 05:36
Show Gist options
  • Save zhanggang807/7fb23fd009be9cc9b2c2c02e9a1be06b to your computer and use it in GitHub Desktop.
Save zhanggang807/7fb23fd009be9cc9b2c2c02e9a1be06b to your computer and use it in GitHub Desktop.
Applescript to resize all windows from a given application. Source credit given in the top.
(*
From http://www.labnol.org/software/resize-mac-windows-to-specific-size/28345/
This Apple script will resize any program window to an exact size and the
window is then moved to the center of your screen. Specify the program name,
height and width below and run the script.
Written by Amit Agarwal on December 10, 2013
*)
set theApp to "MacVim"
set appHeight to 800
set appWidth to 1400
tell application "Finder"
set screenResolution to bounds of window of desktop
end tell
set screenWidth to item 3 of screenResolution
set screenHeight to item 4 of screenResolution
tell application theApp
activate
reopen
repeat with x from 1 to (count windows)
set xAxis to 20 * x as integer
set yAxis to (20 * x) as integer
set the bounds of the window x to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
end repeat
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment