Created
April 18, 2012 00:39
-
-
Save benwyrosdick/2410135 to your computer and use it in GitHub Desktop.
Resize all my main apps for either laptop or cinema display mode
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
set leftArrow to 123 | |
set rightArrow to 124 | |
set upArrow to 126 | |
set downArrow to 125 | |
set halfScreen to {control down, option down, command down} | |
set quarterScreen to {shift down, control down, option down} | |
tell application "Finder" to set screenSize to bounds of window of desktop | |
set width to item 3 of screenSize | |
set height to item 4 of screenSize | |
set delayAmount to 0.5 | |
set laptopScreenWidth to 1440 | |
try | |
-- Google Chrome | |
tell application "Google Chrome" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code rightArrow using halfScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- iTerm | |
tell application "iTerm" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code downArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- MacVim | |
tell application "MacVim" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code leftArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- HipChat | |
tell application "HipChat" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code leftArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- Rdio | |
tell application "Rdio" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code upArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- iTunes | |
tell application "iTunes" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code rightArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "m" using halfScreen | |
end if | |
delay delayAmount | |
-- Skype | |
tell application "Skype" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code downArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "c" using halfScreen | |
end if | |
delay delayAmount | |
-- Messages | |
tell application "iChat" to activate | |
delay delayAmount | |
if width > laptopScreenWidth then | |
tell application "System Events" to key code downArrow using quarterScreen | |
else | |
tell application "System Events" to keystroke "c" using halfScreen | |
end if | |
delay delayAmount | |
end try |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment