How to Change Time-of-Day Trigger Programmatically

Greetings All,

I have a series of macros which tell me to do various things at the end of my day. This works great, but on one day of the week the timing needs to be different from the other six. So, I have two time-of-day triggers, as shown:

Trouble is, every now and then my situation changes so that Saturday is the day I need the different timing, not Sunday! It's driving me nuts having to manually change them all and change them back again to the usual settings whenever this happens.

Is there some way for me to have a macro which gets the desired "different day" (i.e. Saturday, Sunday, whatever) and then changes my time-of-day macros to be in accord with that?

Many thanks! :slight_smile:

Do you want this series of Macros to run one after the other starting at a set time? If so, the simplest solution is to remove the time triggers from the individual Macros and to have a single Master Macro that runs the Macros starting at certain times. Then, if you want to edit the days or times you just have one Macro's trigger to edit.


Thanks Zabobon, but they all run at different times of day, for example the first one is like this:

While the second one is like this:

And so on...

You can still do it. Use @Zabobon's example, set the macros to execute "Asynchronously" (in the Settings cogwheel for each action), then put a "Pause for 25 minutes" between macro 1 and macro 2.

You could do it with AppleScript -- you'd have to change the WhichDays value of the XML of both triggers. That's not too bad if you only want to toggle between Saturday and Sunday. Are there any other triggers on these macros, or just the two "Time of Day" ones?

1 Like

Interesting. Thanks Nige, I've implemented your asynchronous idea and will see how it goes tomorrow evening. Can you tell me what difference setting asynchronous makes, please?

(No, there are no other triggers on any of the 'base' macros)

At the "normal" setting the Macros would each complete before moving on to the next. So, if Macro1 happened to take 10 mins to run and you added a 10 minute pause, Macro2 would start 20 mins after Macro1 started. And if Macro1 happened to take 15 mins to run, Macro2 would start 25 minutes after Macro1 started.

With "asynchronous" set, and a 10 min pause, Macro2 would always start 10 mins after Macro1 started (instead of 10 mins after Macro1 finished).

In other words, "asynchronous" allows the Macros to overlap and allows you to plan their start times as a fixed schedule.

Ah, brilliant! Yes, that's exactly what I need. Thanks so much for such a clear explanation Zabobon, and to both of you for the solution -- I have high hopes it'll be what I need :slight_smile:

If I'm reading this correctly you can use @Zabobon's master macro trigger in combination with a flag in a global variable.

Using three triggers – Normal, Sat, Sun:


Set a flag in a global variable like: global_RunSaturday to TRUE or FALSE.

As appropriate – run or don't run when the trigger activates.

To change the run time you just have to have a couple of macros to change the value of global_RunSaturday.

Thanks ccstone, but I'm happy to just manually change the master macro. Much easier than changing SIX! :slight_smile:

I suggested that you DO use the master macro for this...