See AirTags location history with Automator screenshots

Apple AirTags are good for finding lost items, but they only show the current location, not all locations they have been. Here is a workaround and also an interesting use of Mac Automator.

I was listening to the Intego Mac Podcast recently (search for it in Apple Podcasts app), and there was an interesting item about AirTags. Someone sent an AirTag through the post and wanted to track it just for fun. However, this presents a tricky problem.

If the Find My app is opened on the Apple Mac, the current location of all your devices, including AirTags, is displayed. However, there is no location history. You know where something is now, but not where it has been, like where it was an hour ago. Unless you sit at your Mac and stare at the screen all day writing down the locations devices or AirTags appear at, you will not know where they have been.

There is no location history in Find My, so how could an AirTag be tracked over time? The solution the podcast came up with was to write a script that took a screenshot every couple of minutes of the Find My app. As the location changes, the Find My location is refreshed and the screenshot records it by capturing a screenshot. You can then browse through the collection of screenshots and see where an AirTag was at any time during the day or night.

This led me to wonder how to take screenshots at regular timed intervals on the Mac. Taking one screenshot is easy and there is even an option to take a timed screenshot. Press Shift+Cmd+5 and click Options. You can choose to take a screenshot in 5 or 10 seconds time.

That single screenshot is no use for tracking locations in Find My, so I set out to create a utility to do the job. It sounded like something Automator could do and it turned out to be straightforward.

How do you use Automator to take timed screenshots? All it takes is four simple actions and it can run for as long as you want, saving whatever is on the screen to disk. Tracking AirTag locations in the Find My app is just one possible use of the Automator app.

Create an Automator app

Create an app with Automator on the Apple Mac

Start Automator in the Applications folder on the Mac. It is built in and bundled with macOS. When you are asked to choose a type for your document, click Application. We are going to create an app that can be run like any other app on your Mac.

Drag and drop Automator actions

Create an app with Automator on the Apple Mac

Select the Library in the first list and then click and drag these four items from the second list to the area on the right. There is a > button to expand or contract each item and I have contracted each one to make it easier to read. Find these actions and add them: Take Screenshot, Get specified Finder Items, Rename Finder Items and Loop.

Take a screenshot with Automator

Create an app with Automator on the Apple Mac

The Take Screenshot action looks like this when expanded. It captures the whole screen by default. What you need to do is to tick the Timed box and choose how often you want to take screenshots. I set it to 300 seconds, which is five minutes.

Save Automator screenshots

Save screenshots with Automator on the Apple Mac

Click Save To and then click New. In Finder you need to create the folder you want to save the screenshots to. You also need to save a dummy PNG file there. Any old picture will do. It’s just a placeholder.

Save a screenshot in Automator on the Apple Mac

I created a folder called Screenshots and I copied a file there called Pic.png, but the name is unimportant. Select the file and click Save. The Take Screenshot Automator module will then take a screenshot and save it with this filename in this folder.

Get files with Automator

Rename files with Automator on the Apple Mac

Unfortunately, every screenshot is saved with exactly the same filename, the one specified in the Take Screenshot action. The solution is to rename the file afterwards.

Expand the Get Specified Finder Items action, click the Add button and select the dummy PNG file you added to the folder you want to save screenshots to. Here you can see that I selected Pic.png. The name does not matter as long as it is the same name as in the Take Screenshot action.

Rename files in Automator

Rename files with Automator on the Apple Mac

The output of Get Specified Finder Items becomes the input for Rename Finder Items, so we can rename the screenshot and give it a unique name so they don’t all overwrite each other. Select Add Date or Time at the top. Set the Format to Hour Minute Second, set the Separator to Dash. Leading zeros can be added if you like.

What this does is to take the existing screenshot name, Pic.png, and add the time like Pic 10-27-14.png. The hour, minute and second the screenshot is taken will always be unique (unless you leave this running for 24 hours). The result is a bit like the way macOS names screenshots.

Create loops in Automator

Create a loop in Automator on the Apple Mac

We want to keep taking screenshots at the interval set in the Take Screenshot action (300 seconds), so expand the Loop action, set it to Loop automatically, and then to stop after a certain number of minutes. It is up to you, but 600 minutes is 10 hours, so basically my Automator script will automatically save screenshots every five minutes for 10 hours.

Save the Automator app

Save an Automator app on the Apple Mac

Go to File, Save and save this Automator app with the File Format set to Application. The list of actions is saved with a .app extension and it looks like a regular Mac app. If an Automator app is not right, the app can be reloaded, modified and saved again. Automator loads and saves its own apps.

Test the screenshot app

You must test the app before using it. This is not only to make sure it works, but also to set permissions. The first time the app runs, macOS will ask if it is OK to allow this app to capture the screen, then it will ask if it is OK to allow it to save the screenshot to disk. You have to run it once to click through all the permissions that pop up.

You might need to go to System Preferences > Security & Privacy > Privacy and allow Screen Recording and either Files and Folders or Full Disk Access. It’s just the security in macOS these days and you can’t do anything without giving permission in five different places.

To test the app, you might want to set Take Screenshot to 15 seconds and Loop to one minute. Save and run the app, check it is saving screenshots and quits when the minute is up. If it is OK, load the app back into Automator and set the interval and total time to whatever you want. Save it and it is ready to use.

Power management and screen savers

We are nearly finished and there is just a couple of things to do. If you want to capture screenshots of Find My locations over several hours, make sure the Mac is not set to go to sleep! Plug a MacBook into the mains power and set System Preferences > Battery > Power Adapter to never turn the display off. Also tick the option, Prevent the computer from sleeping automatically

When using this Automator app for several hours to capture Find My, start Find My, run the the Automator screenshot app, turn the screen brightness right down, walk away and leave it. When an Automator app runs, a spinning cog wheel appears in the menu bar. Click it if you want to quit before the Loop timer is scheduled to quit.

Related articles:

Leave a Reply