Use AppleScript to Resize All Windows for Screen Recording

I wasn’t able to find a tool to resize and center all open windows to a specific size for screen recording, so I came up with this AppleScript:

set windowWidth to 1024
set windowHeight to 768

tell application "Finder"
set {0, 0, screenWidth, screenHeight} to bounds of window of desktop
end tell

tell application "System Events"
set position of windows of (application processes whose visible is true) to {(screenWidth - windowWidth) / 2, (screenHeight - windowHeight) / 2}
set size of windows of (application processes whose visible is true) to {windowWidth, windowHeight}
end tell

which you can save as an “Application” via Automator (built-in macOS app):

Automator create an application with AppleScript
Select “Application” document type in Automator.
Run AppleScript to resize the application windows
Add “Run AppleScript” action from the Utilities section and paste in the code from above.

Save it to your desktop or any other convenient location. Double-click the app to run it.

Approve the permissions requests for Finder and System Events. In addition, open the “Settings” app and enable the newly created app under the “Accessibility” section:

Enable Automator app permissions under Settings > Accessibility

Leave a Reply