Script to create calendar events based on shifts in WMT Scheduler

Messages
8
Got bored sitting around at home and decided to make an AppleScript to create events in Calendar from my Web Schedule page. Figured I'd share it with you.

The script is inspired by the VoidTime app that was briefly on the iOS App Store a year or so ago. Some major changes are:
  • You can read the source code for yourself and verify I'm not doing anything nefarious.
  • It's not an app or application, just a script to scrape the info from the web and dump it in your calendar. It won't tell you what kind of leave you're on, or who else is working with you, or anything like that.
  • It only works on macOS. I don't have the skills to create a full-blown app and I wouldn't want to in any case, because then you couldn't read the source code. I imagine the idea could transfer to Windows PowerShell but I have extremely limited experience with that. Anyone who wants to attempt can feel free.
Basically the entire thing is hacked together, but it works and there's even a moderate amount of error-checking built in. That said it really works best if you enter in the proper information, please don't try to stress-test everything.

 
Got bored sitting around at home and decided to make an AppleScript to create events in Calendar from my Web Schedule page. Figured I'd share it with you.

The script is inspired by the VoidTime app that was briefly on the iOS App Store a year or so ago. Some major changes are:
  • You can read the source code for yourself and verify I'm not doing anything nefarious.
  • It's not an app or application, just a script to scrape the info from the web and dump it in your calendar. It won't tell you what kind of leave you're on, or who else is working with you, or anything like that.
  • It only works on macOS. I don't have the skills to create a full-blown app and I wouldn't want to in any case, because then you couldn't read the source code. I imagine the idea could transfer to Windows PowerShell but I have extremely limited experience with that. Anyone who wants to attempt can feel free.
Basically the entire thing is hacked together, but it works and there's even a moderate amount of error-checking built in. That said it really works best if you enter in the proper information, please don't try to stress-test everything.

I am still quite angry that they forced the individual to take the app down instead of seeing a solution and working with the individual. VoidTime made seeing my schedule so much easier and it populated my calendar (even with OT before I received my usual slip informing me) which I shared with my girlfriend so she could see when I was working due to schedule changes. Now my lack of scripts/coding is not up to par at the moment, but is there a way to do this on the phone?
 
is there a way to do this on the phone?

Theoretically yes, someone wrote an app to do it before. Short answer right now is no though.

My guess based on looking at VoidTime's settings is that he did exactly what I did: went to the WMT Scheduler website in the background and automatically entered your login information. For one I don't have the knowledge to create an app like that and for two I'm hoping that the code being readable means there will be less grief from on high about this (unlikely I know, which is why I'm staying anonymous).

In terms of porting this script to iOS, that's doubtful. I did some perfunctory searching just now and it seems like you can use Shortcuts to run an AppleScript command on a connected Mac, but you can't actually run AppleScript on an iOS device itself. Perhaps there's a way to port the whole thing to Shortcuts, I don't know—I haven't worked with Shortcuts at all. My guess is the check-which-question step is too complex, but I could be wrong.

I really don't know much about PowerShell but there may be a way to do it on Windows as well, a quick google produced this post showing how to create a calendar appointment using PS. Maybe that'll be my next project, if there's interest.
 
Update! It works with last week's WMT update now.

The biggest change you'll see is that the script no longer gets the shift start/stop times automatically, because they hid the legends page behind elevated user access. You'll be prompted to enter the times if the script comes across a shift it doesn't know about already—which it probably will, if you've run the old version since last week, because I didn't catch the fact that there was a logic error in the old code and it had to get the shift legends every single time. Oops. That should be fixed now too.

There's also an option at the top of the script to use a "cleaner" and perhaps more reliable method of seeing if a webpage has loaded. This cleaner method requires that the script have more access to your GUI. If you're concerned about that, leave the useOldWFPL property true. If you're okay using the new method, change it to false.

There were a couple other changes in the HTML used on the site, which mean that the pay period dates I'm using as keys are formatted a little differently. You'll probably have duplicate shifts for a couple pay periods if you run the new code directly. The easiest way to prevent this is to go to your Calendar.app and delete all the events for this pay period onwards, and then in Finder go to ~/Application Support/WebScheduleToCalendar/ and just delete the Database.plist file altogether. The file and your events will re-populate when you run the script.

 
Is there a way to edit shift start and stop times if you put them in wrong accidentally?
 
Is there a way to edit shift start and stop times if you put them in wrong accidentally?
Shift times are stored in the file:

[user home folder] > Library > Application Support > WebScheduleToCalendar > ShiftLegends.plist

If you like, you can edit that file directly. Or you can delete the file and the script will re-create it next time it runs. You can delete it manually or by entering the following command in Terminal:

Bash:
rm ~/Library/Application\ Support/WebScheduleToCalendar/ShiftLengends.plist

I still need to fix the logic for mid shifts... that's been on the to-do list since forever. Sorry all.
 
Mid shift logic has finally been fixed! Events for mid shifts which start before 00:00 local time will now begin on the day preceding the date shown in WMT. Mid shifts which begin at 00:00 will continue to begin on the WMT date.
 
Mid shift logic has finally been fixed! Events for mid shifts which start before 00:00 local time will now begin on the day preceding the date shown in WMT. Mid shifts which begin at 00:00 will continue to begin on the WMT date.
I appreciate your help, and this script is awesome! how do I use the mid shift logic? when I put in say for our facility 2230 - 630 shift I put in shift start time 1030PM and end time 630am it says the start time must be before the end time and encounters an error. I may be doing something wrong. Thanks in advance!
 
when I put in say for our facility 2230 - 630 shift I put in shift start time 1030PM and end time 630am it says the start time must be before the end time and encounters an error.
Just tried it and those times work for me.

Make sure that when you enter the times you use the complete and correct format, according to your user settings in System Preferences > Language & Region. Unless you did something funny with the advanced settings, that's probably either "22:30" and "06:30" or "10:30 PM" and "6:30 AM." The space before the AM/PM may be important.
 
Just tried it and those times work for me.

Make sure that when you enter the times you use the complete and correct format, according to your user settings in System Preferences > Language & Region. Unless you did something funny with the advanced settings, that's probably either "22:30" and "06:30" or "10:30 PM" and "6:30 AM." The space before the AM/PM may be important.
I was able to get the mid logic to work thank you! However after I re installed the script as a program anytime I run it, it asks for permission to access every calendar on my calendars for everyday. In settings>privacy and security>calendar I have it set for script editor to have permission and it still does this. But if I save it and run it as a script instead of an application it works. An idea why that would be, or how to fix it?
 
New login?
Per webscheduler page:

"WMT Scheduler scheduled to trainsition to Workforce authentication on 10/11/23, Wednesday at 08:00 AM ET. There will be an application outage for about 45 minutes for the deployment.

After the deployment please note that, upon clicking on Login button in login page, you will be directed to Workforce.faa.gov. From there you may log in with either your PIV card or FAA email address. Prior using FAA email address for login, please follow the instructions in MyAccessMFA to register your FAA email address.

For Login difficulties please contact FAA MyIT by calling 1-844-FAA-MyIT (322-6948), or sending an email to [email protected]."



Those people at MyIT better be ready for the flood of calls incoming from controllers that check their e-mail once or twice a year at best.
 
Per webscheduler page:

"WMT Scheduler scheduled to trainsition to Workforce authentication on 10/11/23, Wednesday at 08:00 AM ET. There will be an application outage for about 45 minutes for the deployment.

After the deployment please note that, upon clicking on Login button in login page, you will be directed to Workforce.faa.gov. From there you may log in with either your PIV card or FAA email address. Prior using FAA email address for login, please follow the instructions in MyAccessMFA to register your FAA email address.

For Login difficulties please contact FAA MyIT by calling 1-844-FAA-MyIT (322-6948), or sending an email to [email protected]."



Those people at MyIT better be ready for the flood of calls incoming from controllers that check their e-mail once or twice a year at best.
eLMS be using it already.
 
A few months ago or whatever I was on my mid the night they beta tested this new way to log in and I was having issues logging in to add the traffic count. The page even said it was the live test or whatever and to leave comments on its operation. I should have told them it sucked and was made by computer people who have to work for the government. It was a pain in the ass to log in on that new FAA Workforce page that lets one choose between their PIV card or FAA email.

I never use my card and here it was not working and not showing my "credentials" or whatever. My password associated with my FAA ID didn't work. Every time something failed I had to not just refresh the page, or close a tab, but close the entire damn browser and start again. Eventually my card worked and that's how I've been doing it since.

I don't need to do the stupid traffic count at home but I do need to see WMT. My FAA password still doesn't work so I have no clue which PW they're looking for there. Resets go to FAA email and it appears logging in from home is no longer allowed. When I go to work I'll have to call the IT people and figure it out.
 
A few months ago or whatever I was on my mid the night they beta tested this new way to log in and I was having issues logging in to add the traffic count. The page even said it was the live test or whatever and to leave comments on its operation. I should have told them it sucked and was made by computer people who have to work for the government. It was a pain in the ass to log in on that new FAA Workforce page that lets one choose between their PIV card or FAA email.

I never use my card and here it was not working and not showing my "credentials" or whatever. My password associated with my FAA ID didn't work. Every time something failed I had to not just refresh the page, or close a tab, but close the entire damn browser and start again. Eventually my card worked and that's how I've been doing it since.

I don't need to do the stupid traffic count at home but I do need to see WMT. My FAA password still doesn't work so I have no clue which PW they're looking for there. Resets go to FAA email and it appears logging in from home is no longer allowed. When I go to work I'll have to call the IT people and figure it out.
The password they want is the 10 digit number on the back of your PIV.
 
Back
Top Bottom