Skip to content

Instantly share code, notes, and snippets.

@datafatmunger
Created August 30, 2018 07:25
Show Gist options
  • Save datafatmunger/fe78086ee84804b2410288afa9b365fe to your computer and use it in GitHub Desktop.
Save datafatmunger/fe78086ee84804b2410288afa9b365fe to your computer and use it in GitHub Desktop.
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