Skip to content

Instantly share code, notes, and snippets.

@masterT
Forked from rfunduk/setup-WxH.applescript
Created November 13, 2015 19: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 masterT/affea0cb0dbe2035b34d to your computer and use it in GitHub Desktop.
Save masterT/affea0cb0dbe2035b34d 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment