Created
June 25, 2016 17:44
-
-
Save jononon/e5984d3b5462cd725bdd51135ec5f42c 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 "Google Chrome" | |
set tabcount to 11 | |
set firstpagetabcount to 12 | |
set secondpagetabcount to 13 | |
set returntocoursepagecount to 9 | |
set moduleURL to "http://www.vdriveusa.com/moodle/mod/flash/view.php?id=111" | |
set AppleScript's text item delimiters to "?" | |
set firstTime to true | |
set pageURL to "a?" | |
set delayTime to 30 | |
repeat | |
try | |
tell application "Google Chrome" | |
activate | |
tell application "System Events" | |
tell application process "Google Chrome" | |
set pageURL to value of text field 1 of toolbar 1 of window 1 | |
end tell | |
end tell | |
end tell | |
on error | |
log "SHITTY PDF" | |
tell application "System Events" to keystroke "w" using command down | |
end try | |
if pageURL is "www.vdriveusa.com/moodle/course/view.php?id=6" then | |
repeat tabcount times | |
tell "System Events" | |
tell application "System Events" to keystroke tab | |
end tell | |
end repeat | |
log tabcount | |
set tabcount to tabcount + 1 | |
tell application "System Events" to keystroke return | |
set firstTime to true | |
else if (text item 1 of pageURL) is "www.vdriveusa.com/moodle/mod/flash/message.php" then | |
log "END OF MODULE" | |
repeat returntocoursepagecount times | |
tell "System Events" | |
tell application "System Events" to keystroke tab | |
end tell | |
end repeat | |
tell application "System Events" to keystroke return | |
set firstTime to true | |
else if (text item 1 of pageURL) is "www.vdriveusa.com/moodle/mod/flash/view.php" then | |
log "MODULE" | |
if firstTime then | |
log "FIRST TIME" | |
repeat firstpagetabcount times | |
tell "System Events" | |
tell application "System Events" to keystroke tab | |
end tell | |
end repeat | |
tell application "System Events" to keystroke return | |
set firstTime to false | |
else | |
log "SECOND TIME" | |
repeat secondpagetabcount times | |
tell "System Events" | |
tell application "System Events" to keystroke tab | |
end tell | |
end repeat | |
tell application "System Events" to keystroke return | |
end if | |
else if (text item 1 of pageURL) is "www.vdriveusa.com/moodle/mod/url/view.php" then | |
log "SHITTY VIDEO" | |
tell "System Events" | |
tell application "System Events" to keystroke (ASCII character 8) | |
end tell | |
else if (text item 1 of pageURL) is "www.vdriveusa.com/moodle/mod/quiz/view.php" then | |
log "SHITTY QUIZ" | |
tell "System Events" | |
tell application "System Events" to keystroke (ASCII character 8) | |
end tell | |
end if | |
delay delayTime | |
end repeat | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment