Create a gist now

Instantly share code, notes, and snippets.

anonymous /gist:5020503
Created Feb 23, 2013

What would you like to do?
tell application "Finder" to set desktopBounds to bounds of window of desktop
set screenWidth to item 3 of desktopBounds
set screenHeight to item 4 of desktopBounds
tell application "System Events"
set apps to every process whose visible is true
if ((count of apps) = 0) then return
end tell
repeat with i from 1 to (count of apps)
tell application "System Events"
set anApp to application file of (item i of apps)
end tell
tell application (anApp as string)
set resizableAppWindows to (every window whose resizable is true)
end try
repeat with ii from 1 to (count of resizableAppWindows)
set appWindow to item ii of resizableAppWindows
set bounds of appWindow to {10, 35, (screenWidth - 10), (screenHeight - 80)}
end repeat
end tell
end repeat

rfabbri commented Jun 25, 2015

I get the error

  • Can’t make alias into type string.

I propose line 12 to be changed to

  • set anApp to (POSIX path of application file) of (item i of apps)

Is there a way to get this working when a user has multiple screens? I use a laptop with two monitors plugged in and it just forces the window to be resized to the width of the 3 monitors combined..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment