Created
August 30, 2018 07:25
-
-
Save datafatmunger/fe78086ee84804b2410288afa9b365fe to your computer and use it in GitHub Desktop.
This file contains 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
activate application "Safari" | |
on send_message(msg) | |
tell application "System Events" | |
tell process "Safari" | |
click at {436, 763} | |
delay 2 | |
keystroke msg | |
delay 2 | |
click at {1012, 794} | |
delay 2 | |
end tell | |
end tell | |
end send_message | |
send_message("foo") | |
send_message("bar") | |
set msg to "" | |
tell application "Safari" | |
set val to do JavaScript " | |
var list = document.querySelectorAll('._58nk') | |
list[list.length - 1].innerHTML | |
" in document 1 | |
set msg to val | |
end tell | |
if (msg = "bar") then | |
send_message("baz") | |
else | |
send_message("booze") | |
end if |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment