Guest User

Untitled

a guest
Sep 21st, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.08 KB | None | 0 0
  1. property numChromeWindows : 0
  2. property ChromePos : {}
  3. property ChromeSize : {}
  4. property TermPos : 0
  5. property TermSize : 0
  6. property PHPStormPos : 0
  7. property PHPStormSize : 0
  8. property MailPos : 0
  9. property MailSize : 0
  10. property CollPos : 0
  11. property CollSize : 0
  12. property AdiumContactsPos : 0
  13. property AdiumContactsSize : 0
  14. property AdiumIMSize : 0
  15. property AdiumIMPos : 0
  16. property OFPos : 0
  17. property OFSize : 0
  18.  
  19. display dialog "Set Window Position or Save Window Position?" buttons {"Restore", "Save"} default button "Restore"
  20. set theResult to result
  21.  
  22. tell application "System Events"
  23. if (button returned of theResult is "Restore") then
  24. -- Restore Settings
  25. if (numChromeWindows > 0) then
  26. tell process "Google Chrome Canary"
  27. repeat with i from 1 to numChromeWindows
  28. set position of window i to (item i of ChromePos)
  29. set size of window i to (item i of ChromeSize)
  30. end repeat
  31. end tell
  32. end if
  33. if (PHPStorm is not {0, 0}) then
  34. tell process "PhpStorm"
  35. set position of window i to (item i of PHPStormPos)
  36. set size of window i to (item i of PHPStormSize)
  37. end tell
  38. end if
  39. if (MailPos is not {0, 0}) then
  40. tell process "Mail"
  41. set position of window i to (item i of MailPos)
  42. set size of window i to (item i of MailSize)
  43. end tell
  44. end if
  45. if (TermPos is not {0, 0}) then
  46. tell process "Terminal"
  47. set position of window 1 to TermPos
  48. set size of window 1 to TermSize
  49. end tell
  50. end if
  51. if (CollPos is not {0, 0}) then
  52. tell process "Colloquy"
  53. set position of window 1 to CollPos
  54. set size of window 1 to CollSize
  55. end tell
  56. end if
  57. if (AdiumContactsPos is not {0, 0}) then
  58. tell process "Adium"
  59. set position of window "Contacts" to AdiumContactsPos
  60. set size of window "Contacts" to AdiumContactsSize
  61. repeat with i from 1 to (count windows)
  62. if ((window i) is not (window "Contacts")) then
  63. set position of window i to AdiumIMPos
  64. set size of window i to AdiumIMSize
  65. end if
  66. end repeat
  67.  
  68. end tell
  69. end if
  70.  
  71. else
  72. -- Save Settings
  73. tell process "Google Chrome Canary"
  74. set numChromeWindows to count windows
  75. set ChromePos to {}
  76. set ChromeSize to {}
  77. repeat with i from 1 to numChromeWindows
  78. set end of ChromePos to (position of window i)
  79. set end of ChromeSize to (size of window i)
  80. end repeat
  81. end tell
  82. tell process "PhpStorm"
  83. set PHPStorm to position of window 1
  84. set PHPStorm to size of window 1
  85. end tell
  86. tell process "Mail"
  87. set Mail to position of window 1
  88. set Mail to size of window 1
  89. end tell
  90. tell process "Terminal"
  91. set TermPos to position of window 1
  92. set TermSize to size of window 1
  93. end tell
  94. tell process "Colloquy"
  95. set CollPos to position of window 1
  96. set CollSize to size of window 1
  97. end tell
  98. tell process "Adium"
  99. set AdiumContactsPos to position of window "Contacts"
  100. set AdiumContactsSize to size of window "Contacts"
  101. repeat with i from 1 to (count windows)
  102. if ((window i) is not (window "Contacts")) then
  103. set AdiumIMPos to (position of window i)
  104. set AdiumIMSize to (size of window i)
  105. end if
  106. end repeat
  107. end tell
  108. end if
  109. end tell
Add Comment
Please, Sign In to add comment