Try (and failing) to create a macro to run a shortcut with a 24 hour cooldown

@wgstarks

I have left the timing similar to your initial macro but this should get you started.

Set the initial Global_LastWifiTriggerTime per the below. One caveat, based on this setting, THE FIRST TIME the macro will run the immediately on startup because it has the difference will be > 1 day.

The macro looks like this:

Here is the macro to download:

Time Machine Backup.kmmacros (25.9 KB)

**You need to make sure the Shortcut works. The best way to do that is to run the Shortcut directly from the Shortcut application" You should be good to go!

Let us know should you need anything else.

This, for starters.

The trigger you've used will fire when you connect to your home WiFi. When you boot your machine it will connect to the WiFi long before the KM Engine is running -- and "is already connected" doesn't count as a trigger.

What are you trying to do here? Limit TM to only run daily (rather than hourly)? Why does it matter what network you're on?

And, always a favourite -- what version of macOS are you running?

As a fix to Nigel's comment I made two changes:

  1. Macro runs at Engine launch.
  2. Backup is conditioned so that you re connected to your specific Wifi.

So with the changes the macros run when you start your computer. If you are on your specified network the backup occurs and, if not then the macro harmless ends.

The revised macro is as below:

Time Machine Backup.kmmacros (35.9 KB)

Let us know how this works!

Thanks. I’ll give this a shot a little later when I have a few minutes.

If I’m not on my home network my laptop won’t be able to connect to the NAS hosting the TM backup share and I’ll get failed backup notifications. I wish I could set conditions in Time Machine. That would make everything simpler.

And why the 24 hours? And what's your OS?

Just don’t see a need to backup any more often than that. It was just an arbitrary number though. 12 hours would probably be just as good. Just want to prevent frequent backups if I happen to need to boot the laptop multiple times over a really short period.OS is macOS26.5.2.

It appears I have reached a limit for max number of daily posts so I’ll have to post back tomorrow.

Have you tried, and was there a problem with the default hourly? Unless there's a lot of churn of data they don't care about (in which case they're better off keeping the changing data in a directory that's excluded from TM backups), most of my users don't notice the difference between hourly and daily backups.

In fact the users that have problems are those that back up less frequently, because those backups take much longer!

Anyways...

As you'll find when trying @Joel's macro above, there's no reliable way to do what you want with a single trigger unless that trigger is a frequently-running periodic. The network trigger won't fire if you are already connected to your home wireless, Joel's won't run if you connect to your wireless without then restarting the KM Engine, and so on. And anything with a long pause runs the risk of getting nuked with a "Cancel All Macros" command.

So the simplest solution would be (borrowing heavily from @Joel):

Time Machine Backup (Periodic).kmmacros (46.0 KB)

Image

Couldn’t post back yesterday due to forum spam protection (had too many posts for one day) but finally discovered the problem. The network check condition requires special access in macOS privacy settings and will always show as false if it’s not configured. Because KM evaluates all conditions together in the editor I was mistakenly thinking that my time delay calculation wasn’t working and that was causing the false evaluation. As soon as I tried @Nige_S ’s macro I realized the correct problem and knew that it had to be caused by Apple’s privacy and security restrictions. Everything is working great now. Wound up using a combination of the macros provided by @Nige_S and @Joel. Using the editor launch trigger with a 60 second pause (since it seems that the editor launches well before WiFi connects) and an every 5 minute trigger in case the first one fails or if the laptop happens to already be booted when the 24 hour condition becomes true.

Thanks to everyone for your help.

Thrilled that you got it working the way that you want.