Execute Macro Only if After Specific Time of Day

I would like a macro to run when I unlock my computer only if is currently after a time of day (i.e., run this macro when I unlock my computer and it's after 9am).

What is the best way to conditionally check if current time is after a specified time?


Howdy, welcome to the forum! As you might have already figured out, this is a great community full of people who love to help.

To do this you can use the ICUDateTime token in an If/Else action to verify that the current time is past the time you want the macro to run.

In the example below, the token is compared against a set value (09) to see if the current hour is 9 or greater (indicating it is 9:00am or after). If it is, then the action(s) you place in the area where the yellow comment is now will execute. If it is not, then the macro will self-cancel.

Let me know if you have any questions about it and i'll be glad to help more!


01)Scratchpad.kmmacros (4.0 KB)

Macro screenshot (click to expand/collapse)

Following on from what Chris has said, if you happen to only need to run the task once a day when you unlock your Mac, see this post with the macro I use every day.

Best wishes,