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.

Hello airy, hello noisneil,

Please give me a last hint how to save the screenshots under the name "Karma01", "Karma02" ..., the apendix with date and time is from minor importance, I can arrange the screenshots first with the time and then with the name.

Which language is jused there, perhaps I can learn myself how to do it?

Would be a nice christmas-present lying under my digital christmas-tree, if I get it working when 2024 is beginning.


I think the reason your action didn't work is because you didn't correctly take my advice. I said,

All you would have to do, I think, is add the following in the above string:
%ICUDateTime%EEE, MMM d, yyyy h:mm%

But here's what you did:

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

Do you see what you did wrong? You entered a slash between the filename and the date. That won't work correctly because that will indicate a subfolder.

Also, you didn't upload your latest macro which contains this change, so I can't review it.

Here is a completely different path.

There is an AI screenshot renaming service (subscription based) named "Keep it Shot". Here's the link to it:

Searching the index it makes might be simplier than renaming the files. There is a free plan to test it out and see if it's useful.

Hello and sorry for submerging, was absorbed by life ...
Really want to bring this to work.

Thanks to your hint with the slash and by try and error (I don't even know whitch script language is used, hint would be nice for checking some basic grammar), I brought the Date and Time part of the name in the desired form.

Now the one thing left to do ist assigning each screen shot the right Air Tag (from 01 to 08).

In the Version "Karma 05", where I have just changed the time part, the first part is just a huge number.

Karma 05.kmmacros (54.6 KB)

I have replaced the part "Local__FilenName" with "Karma01" for the first round guiding to Air Tag 01, "Karma02" ...

Karma 06.kmmacros (54.6 KB)

But know I get the script as the name of the screenshot.

The part "Increment filename" and the way the part "Write screenshot to folder" is referring to "Increment filename" is beyond my understanding of the matter.

Desired form for the filenames would be:
Karma01_2024_02_29__17_35 for the first screenshot, where the cursor is guided to Air Tag Nr. 1.
Karma02_2024_02_29__17_35 and so on ...

So by arranging files by filenames, I have first the the screenshots of one Air Tag together and these screenshots arranged in time.

Hope, I'm understandable, thanks for help for the last step to have a working base, looking forward to improve it.

Thanks for the hint. I hope I'm close to bring it to work, so I don't have to outsource.

Greetings from good old Europe,

Hello Again,
Try to make this little last step, naming a screenshot from Air Tag 01: KARMA01_2024_03_21__09_00
Then the cursor moves to Air Tag 02 in "FIND MY", screenshot is made, naming it KARMA02_2024_03_21__09_00.
This goes on until Air Tag 08 is screenshots, then after a pause of 15 min, it restarts with a screenshot of Air Tag 01, naming it: KARMA01_2024_03_21_09_15 ...

So I think I don't need the increment-filename-part, because just when you've been through the parts "go to Air Tag 01 and make a screenshot", you just assign it in "Write screenshot to a folder" "Karma01_2024_03_21_09_00" ...

But I don't know what to write exactly for naming it.

So my last 3 Questions:

  1. Can I just delete the part "increment filename" or do I need it for some other reason?
  2. Why there are two "Screen Capture front window" in each round (one after "Move to ...", one after "increment filename", the selection after "screen capture to" is different): is one to delete and what is the right selection for "screen capture to"?
  3. Hot to fill the first part of the filename in "Write screenshot to folder" for it gets the desired form I've described above?

Would be my biggest Easter-Egg, when the thing would run finally.
Greetings, vierviervier

Karma 07.kmmacros (54.6 KB)

It isn't a "script language" as such -- those are KM "Tokens", replaced with whatever they evaluate to when the macro runs. In this case "the contents of the variable Local__FolderPath", "the contents of the variable Local__FileName", and "the current date/time, formatted in a particular way".

You'll find the Variable and ICUDateTime tokens in the list of Tokens on the Wiki, and a general explanation of Tokens in the manual.

I finally find a way to write it with exactly the result I wanted.
KARMA.kmmacros (199.0 KB)

Even the Buddhist Gong sounds after every Screencapture.

One thing remains for that my screen does not pass out.
After the 8 Screenshots are made, there is a pause of 15 min, then the next turn starts.
Think it would be better if the Screen after one round goes into screen-saver modus an after the pause of 15 min comes back for the next round.
I haven't found an action to do so, so I guess its more complicated, perhaps its easy for someone to help me out.
Thanks and greetings.