Skip to content

Instantly share code, notes, and snippets.

@jononon
Created July 10, 2017 23:20
Show Gist options
  • Save jononon/4c984afecc1cd2df1798b9fbe38ec24b to your computer and use it in GitHub Desktop.
Save jononon/4c984afecc1cd2df1798b9fbe38ec24b to your computer and use it in GitHub Desktop.
activate application "Google Chrome"
set firstname to "firstname"
set lastname to "lastname"
set tel1 to "310"
set tel2 to "---"
set tel3 to "----"
set dlid to "driverslicencenumber"
set pageURL to "a?"
set locationList to {"ARLETA", "BELL GARDENS", "BELLFLOWER", "COMPTON", "CULVER CITY", "EL MONTE", "FULLERTON", "GLENDALE", "HAWTHORNE", "HOLLYWOOD", "INGLEWOOD", "LONG BEACH", "LOS ANGELES", "MONTEBELLO", "NEWHALL", "OXNARD", "PASADENA", "SAN PEDRO", "SANTA MONICA", "SANTA PAULA", "SIMI VALLEY", "THOUSAND OAKS", "TORRANCE", "VAN NUYS", "WEST COVINA", "WESTMINSTER", "WHITTIER", "WINNETKA"}
(*5 2 2 6*)
repeat with location in locationList
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
end try
if pageURL is "https://www.dmv.ca.gov/wasapp/foa/clear.do?goTo=officeVisit" then
repeat 5 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
set loc to location
tell "System Events"
tell application "System Events" to keystroke loc
end tell
repeat 2 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke down
end tell
tell "System Events"
tell application "System Events" to keystroke up
end tell
repeat 2 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke space
end tell
repeat 2 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke dlid
end tell
repeat 5 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke firstname
end tell
tell "System Events"
tell application "System Events" to keystroke tab
end tell
tell "System Events"
tell application "System Events" to keystroke lastname
end tell
tell "System Events"
tell application "System Events" to keystroke tab
end tell
tell "System Events"
tell application "System Events" to keystroke tel1
end tell
tell "System Events"
tell application "System Events" to keystroke tel2
end tell
tell "System Events"
tell application "System Events" to keystroke tel3
end tell
repeat 1 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke return
end tell
delay 2
tell application "Google Chrome"
tell active tab of window 1 to set input to execute javascript "document.getElementsByClassName(\"no-margin-bottom\")[2].outerText"
end tell
log location & " " & input
repeat 13 times
tell "System Events"
tell application "System Events" to keystroke tab
end tell
end repeat
tell "System Events"
tell application "System Events" to keystroke return
end tell
delay 2
end if
end repeat
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment