Google Calendar Scheduler v2: The Nightmare Cowers
Watch the demo video here.
Built using Python 3, and utilizing Windows Task Scheduler, Twilio, and Selenium Webdriver.
My dream is to one day have a script that automatically detects when my work schedule has been posted, fills in my Google Calendar for me, and then sends my wife and I a text alerting us to its completion. I have broken this up into a three-stage process which I describe in detail here. This is the second installment, and playing off the title of the first portion of this code, we have almost fully automated this nightmare.
The program is designed to be automatically run every Thursday of every week from 3:00 P.M. to 6:00 P.M. This is most often the window in which the higher-ups post the schedule. I accomplished this using Windows Task Scheduler to run the batch file associated with this script. The script itself is what limits its runtime to 3 hours. From here, the script has the ability to navigate to my work website, log me in, and find my schedule. Nothing new here so far (we already had this ability). What's different though is everything afterward.
After finding the correct page, the program grabs all of the text from that page and RegExs for the phrase "Next Week". This is a button that is dynamically added every Thursday, and disappears every Monday. The script then waits 5 minutes, refreshes the page, and tries looking again. It does this for 3 hours; only exiting if it finds the match (meaning that schedules are posted) or runs out of time. Either way, my wife and I receive a text (accomplished by utilizing Twilio) as to the status; that is, whether or not it found anything, or if there was an error on a particular refresh attempt.