Skip to content

Instantly share code, notes, and snippets.

@OKsign
Created July 30, 2018 06:00
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 OKsign/6efbf860eeab5f20d36ab6c58f4a5198 to your computer and use it in GitHub Desktop.
Save OKsign/6efbf860eeab5f20d36ab6c58f4a5198 to your computer and use it in GitHub Desktop.
-- requirement: set shortcut in 'MercuryMover' for Move to Option + W
-- user input (up to 9 names)
set nameList to {"", "", "", "", "", "", "", "", ""}
-- user input (up to 9 keys)
set key1 to ""
set key2 to ""
set key3 to ""
set key4 to ""
set key5 to ""
set key6 to ""
set key7 to ""
set key8 to ""
set key9 to ""
-- end of user input
tell application "System Events"
set activeApp to (get name of first process where it is frontmost)
end tell
set nameList2 to {}
repeat with i from 1 to count nameList
if {nameList's item i} does not contain "" then
set nameList2's end to nameList's item i
end if
end repeat
delay 0.02
set PickName to (choose from list nameList2 with prompt "Set Size and Position to..." with title "Script 13")
if PickName is not false then
tell application "System Events"
tell process activeApp
set frontmost to true
end tell
end tell
repeat 300 times
tell application "System Events"
set activeApp2 to (get name of first process where it is frontmost)
if activeApp2 is activeApp then
set goResize to 1
exit repeat
end if
end tell
end repeat
if goResize is 1 then
if (item 1 of PickName) is (item 1 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key1
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 2 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key2
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 3 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key3
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 4 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key4
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 5 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key5
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 6 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key6
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 7 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key7
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 8 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key8
delay 1
key code 53
end tell
return
end if
if (item 1 of PickName) is (item 9 of nameList) then
tell application "System Events"
keystroke "w" using option down
delay 1.5
keystroke key9
delay 1
key code 53
end tell
return
end if
end if -- goResize is 1 then
end if -- PickName is not false
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment