Skip to content

Instantly share code, notes, and snippets.

@fabiomadge
Last active August 29, 2015 14:07
Show Gist options
  • Save fabiomadge/eb7e5618ccfb9dbc40e9 to your computer and use it in GitHub Desktop.
Save fabiomadge/eb7e5618ccfb9dbc40e9 to your computer and use it in GitHub Desktop.
Detects signup button and sends SMS
  1. Clone this ifttt recipe

  2. Open this script in the AppleScript Editor

  3. Open the LV-Anmeldung page of the desired course in safari and get back to the editor

  4. Push run and find something else to do

--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