Last active
December 3, 2024 11:48
-
-
Save aielwaste/0f27c53a765c1b387159aed2369b2718 to your computer and use it in GitHub Desktop.
Automatically Resize Mac App Window
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* This AppleScript will resize the current application window to the height specified below and center it in the screen. Compiled with code from Natanial Wools and Amit Agarwal *) | |
set the_application to (path to frontmost application as Unicode text) | |
set appHeight to 1440 | |
set appWidth to 900 | |
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 the_application | |
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