Last active
August 29, 2015 14:07
-
-
Save fabiomadge/eb7e5618ccfb9dbc40e9 to your computer and use it in GitHub Desktop.
Detects signup button and sends SMS
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
--row of the desired group | |
property row : 2 | |
--hashtag set for ifttt mail | |
property hashtag : "#dsupdate" | |
repeat | |
if courseIsReady() then sendMail() | |
delay 31 | |
end repeat | |
on courseIsReady() | |
set val to false | |
tell application "Safari" | |
set docUrl to URL of front document | |
set URL of front document to docUrl | |
set buttonName to (characters 1 thru (7 - (length of (row as text))) of "btn0000" & row) | |
set scrpt to "document.getElementsByName('" & buttonName & "').length > 0" | |
set val to do JavaScript scrpt in front document | |
end tell | |
return val | |
end courseIsReady | |
on sendMail() | |
tell application "Mail" | |
set theMessage to make new outgoing message with properties {visible:true, subject:hashtag, content:"go!"} | |
tell theMessage | |
make new to recipient at end of to recipients with properties {name:"IFTTT", address:"trigger@ifttt.com"} | |
end tell | |
send theMessage | |
end tell | |
end sendMail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment