Skip to content

Instantly share code, notes, and snippets.

@phdesign
Created March 5, 2017 08:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save phdesign/0cd0faa2db98fdf02e5df061095b03ff to your computer and use it in GitHub Desktop.
Save phdesign/0cd0faa2db98fdf02e5df061095b03ff to your computer and use it in GitHub Desktop.
(*
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 "Google Chrome"
set appHeight to 720
set appWidth to 1280
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
set yAxis to (screenHeight - appHeight) / 2 as integer
set xAxis to (screenWidth - appWidth) / 2 as integer
set the bounds of the first window to {xAxis, yAxis, appWidth + xAxis, appHeight + yAxis}
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment