Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- property numChromeWindows : 0
- property ChromePos : {}
- property ChromeSize : {}
- property TermPos : 0
- property TermSize : 0
- property PHPStormPos : 0
- property PHPStormSize : 0
- property MailPos : 0
- property MailSize : 0
- property CollPos : 0
- property CollSize : 0
- property AdiumContactsPos : 0
- property AdiumContactsSize : 0
- property AdiumIMSize : 0
- property AdiumIMPos : 0
- property OFPos : 0
- property OFSize : 0
- display dialog "Set Window Position or Save Window Position?" buttons {"Restore", "Save"} default button "Restore"
- set theResult to result
- tell application "System Events"
- if (button returned of theResult is "Restore") then
- -- Restore Settings
- if (numChromeWindows > 0) then
- tell process "Google Chrome Canary"
- repeat with i from 1 to numChromeWindows
- set position of window i to (item i of ChromePos)
- set size of window i to (item i of ChromeSize)
- end repeat
- end tell
- end if
- if (PHPStorm is not {0, 0}) then
- tell process "PhpStorm"
- set position of window i to (item i of PHPStormPos)
- set size of window i to (item i of PHPStormSize)
- end tell
- end if
- if (MailPos is not {0, 0}) then
- tell process "Mail"
- set position of window i to (item i of MailPos)
- set size of window i to (item i of MailSize)
- end tell
- end if
- if (TermPos is not {0, 0}) then
- tell process "Terminal"
- set position of window 1 to TermPos
- set size of window 1 to TermSize
- end tell
- end if
- if (CollPos is not {0, 0}) then
- tell process "Colloquy"
- set position of window 1 to CollPos
- set size of window 1 to CollSize
- end tell
- end if
- if (AdiumContactsPos is not {0, 0}) then
- tell process "Adium"
- set position of window "Contacts" to AdiumContactsPos
- set size of window "Contacts" to AdiumContactsSize
- repeat with i from 1 to (count windows)
- if ((window i) is not (window "Contacts")) then
- set position of window i to AdiumIMPos
- set size of window i to AdiumIMSize
- end if
- end repeat
- end tell
- end if
- else
- -- Save Settings
- tell process "Google Chrome Canary"
- set numChromeWindows to count windows
- set ChromePos to {}
- set ChromeSize to {}
- repeat with i from 1 to numChromeWindows
- set end of ChromePos to (position of window i)
- set end of ChromeSize to (size of window i)
- end repeat
- end tell
- tell process "PhpStorm"
- set PHPStorm to position of window 1
- set PHPStorm to size of window 1
- end tell
- tell process "Mail"
- set Mail to position of window 1
- set Mail to size of window 1
- end tell
- tell process "Terminal"
- set TermPos to position of window 1
- set TermSize to size of window 1
- end tell
- tell process "Colloquy"
- set CollPos to position of window 1
- set CollSize to size of window 1
- end tell
- tell process "Adium"
- set AdiumContactsPos to position of window "Contacts"
- set AdiumContactsSize to size of window "Contacts"
- repeat with i from 1 to (count windows)
- if ((window i) is not (window "Contacts")) then
- set AdiumIMPos to (position of window i)
- set AdiumIMSize to (size of window i)
- end if
- end repeat
- end tell
- end if
- end tell
Add Comment
Please, Sign In to add comment