Skip to content

Instantly share code, notes, and snippets.

@rfunduk
Created August 22, 2013 21:27
Show Gist options
  • Save rfunduk/6313009 to your computer and use it in GitHub Desktop.
Save rfunduk/6313009 to your computer and use it in GitHub Desktop.
Example AppleScript for re-arranging commonly used windows for a screen resolution. Eg. switching between laptop at 1440x900 and external monitor at 2560x1440 is a big pain, requiring a lot of moving around and resizing of windows. So instead you adapt this script, make a setup-1440x900.applescript and a setup-2560x1440.applescript, and run them…
tell application "Flint" to activate -- needs to be in front
tell application "System Events" to tell application process "Flint"
try
get properties of window 1
set size of window 1 to {700, 800}
set position of window 1 to {1700, 300}
end try
end tell
tell application "Adium" to activate -- needs to be in front
tell application "System Events" to tell application process "Adium"
try
get properties of window 2
set position of window 2 to {2560 - 111, 21}
get properties of window 1
set position of window 1 to {1600, 320}
set size of window 1 to {700, 800}
end try
end tell
tell application "Tweetbot" to activate -- needs to be in front
tell application "System Events" to tell application process "Tweetbot"
try
get properties of window 2
set position of window 2 to {50, 400}
end try
end tell
tell application "Google Chrome" to activate -- needs to be in front
tell application "System Events" to tell application process "Chrome"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {625, 21}
set size of window x to {1250, 2560}
end repeat
end try
end tell
tell application "Sublime Text" to activate -- needs to be in front
tell application "System Events" to tell application process "Sublime Text"
try
repeat with x from 1 to (count windows)
get properties of window x
set position of window x to {250, 21}
set size of window x to {1250, 2560}
end repeat
end try
end tell
tell application "iTerm" to activate -- needs to be in front
tell application "System Events" to tell application process "iTerm"
try
get properties of window 1
set position of window 1 to {150, 100}
set size of window 1 to {2100, 1200}
end try
end tell
@michaeldmueller
Copy link

Are you able to get this working with Sublime Text? It's not working for me

@levbrie
Copy link

levbrie commented Nov 5, 2016

Works for me with Sublime Text

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