Screencapture: Give it a name and save it in a folder


this ist the macro as fas as I can bring it forward at the moment:

Karma 03.kmmacros (54.5 KB)

I just have the actions for the screenshots of Air Tag 01 and 02, waiting for a complete screenshot-sequence to copy and paste it for Air Tag 03-08.

There is just one Problems remaining for perfect use:

The Filename in the form Karma01_YEAR_MONTH_DAY_HOUR/MINUTE (or something comparable), Karma02 ...

After one cycle is complete and I got 8 screenshots in my folder, the macro should pause for 15 minutes then restart making the 8 screenshots ... for like 600 times.

It's not a problem that the computer does nothing else than making these screenshots. I've bought an old model just for this task.

Perhaps you can help me creating the filename for I'm afraid it's beyond my capabilities for the moment.

Ah, and one last thing just for cosyness: with my old automator macro programm (which works quite well, just that after some hours the mouse icon starts to move slower and slower) by making the screenshot the computer makes a sound like making a photo, giving me the feeling that the programm is running and my post is watched.
Perhaps it`s possible to integrate the sound, too?

When you use the "Write File" action you can simply include the date in there, if that's really what you want to do. Currently you use this string:


All you would have to do, I think, is add the following in the above string:

%ICUDateTime%EEE, MMM d, yyyy h:mm%

But really, you shouldn't be doing that at all because files already have dates saved along with them.

As for your question about playing a camera sound, in its Play Sound action, KM doesn't have a "camera sound," but it does allow you to choose an AIFF file containing your own sound. So if you go online to find a collection of AIFF sound files, you might find a camera sound, so you can download it to your computer and get KM to play it.

If your code works and you are happy, that's all that should matter. But I see several ways that your code could be improved:

  • Use subroutines to repeat code, don't repeat code manually;
  • Use KM actions to create file names, don't create file names using shell scripts;
  • Use OCR to save AirTag locations, rather than screen shots; (I've done this, and it worked beautifully)
  • Rely on date attributes rather than adding dates to filenames;
  • Use triggers to run this macro every 15 minutes, rather than a loop with a 15 minute pause.

Hi Airy,
thanks a lot, seems that I'm on target.

I think i'm starting with just making the code work and than step by step try to integrate your suggestet improvements (I will make research for every step(subroutines?, OCR? (I will find out), but it's quite probably, that I need further help).

To connect the screenshot with AIFF sound, I'm looking forward to do. A buddistic "gong" will be even more relaxing than a simple click.

For beginning: I've integrated your line in the string in this form:

%Variable%Local__FolderPath%/%Local__FileName%/%ICUDateTime%EEE, MMM d, yyyy h:mm%.png

By running the macro, the screenshot is just saved as "Karma 00".

You are writing with an zero macro-knowlege-man, so I do not even know which language is used there, what is the meaning of the "%" (I have connected it with the previous string with /%) ...

For me, the most important thing concerning the naming of the screenshot is that the screenshot, which shows the position of the Air Tag 01 ist named "Karma01", for Air Tag 02 "Karma02".
The tag with date and time is of minor importance, the thought behind was just, that if I arrange the screenshot-file by name of the file, i get just the right order with all the screenshots from one Air Tag in the sequence of their recording time and because there are many Karma01, to have different filenames.

Actually the screenshots were named Karma 01 ... just in sequence, not connected to the Airtag they screenshoted.

Hope my enlish is understandably, a foreign language combined with zero knowlege of macros, it's sweaty.

Greetings, an thank for your help.