Still stumbling (happily !) through the basics of regex and currently struggling. I have the month's work schedule in excel, and wrote a macro that crawls through it pulling the dates and times I am working, like so:
08/29/16 7:30am - 2:30pm Calendar Work 08/30/16 7:30am - 2:30pm Calendar Work 08/31/16 9:30am - 5:00pm Calendar Work 08/31/16 1:00pm - 8:00pm Calendar Work 09/02/16 7:30am - 2:30pm Calendar Work
I have a second macro that uses this text to enter the shifts into Fantastical 2, my preferred calendar app.
There are some days where I work longer shifts, which are written in to the calendar separately, like on 08/31/16 above, seen here:
Currently, my macro for Fantastical 2 enters this as two overlapping shifts, which I go back later to manually correct. I'd like to fix this, because the whole reason I wrote the macros in the first place was to alleviate anxiety over having copied my schedule wrong manually... but I'm still doing things manually, so it isn't done yet!
I'd like to take those two lines:
08/31/16 9:30am - 5:00pm Calendar Work
08/31/16 1:00pm - 8:00pm Calendar Work
And make a new line:
08/31/16 9:30am - 8:00pm Calendar Work
Clarification: I do not need to check and see if the times are overlapping, I only need to find a way to take the start time from Line 1, and the end time from Line 2. I know they are overlapping shifts because the dates are the same.
I think what I have to do is use regex to check each line against the last, and if the dates match
(\d\d\/\d\d\/\d\d), then I need to take the first time group
(\d:\d\dam) from line 1, and the last time group from the line 2.
(\d:\d\dpm), and use those groups to create line 3.
During this, I need to NOT enter Line 1, and Line 2 into Fantastical, and probably create a second list of exceptional shifts (all of the various "Line 3's") and circle back to enter them after all of the regular shifts have been entered.
I think I need a lot of help, possibly more than I can get from the kindness of experts... but I also think I'm overthinking it, and it might be easier than it seems. Sorry to go into such detail.
Here are the macros I am using, and an excel file with an example schedule:
scheduleExcelExample.zip (39.1 KB)
[SCH] A. Pull List of Work Shifts.kmmacros (12.9 KB)
[SCH] B. Add Work Shifts to Fantastical 2.kmmacros (9.0 KB)
[SCH]~Check Name (SUB).kmmacros (12.9 KB)
Thank you for any help!