Write System Clipboard to File with a +1 variable -- forgot how :-/

I forgot how to do this, and I know it's rudimentary :sweat_smile:

This basic automation (1.) takes a screenshot at a set of dimensions, (2.) clicks a mouse. Then repeats with a short pause. All screenshots go into a folder.

Ideally, the files save on my Desktop in a folder called "temp" or whatever.

..but I can't remember how to make all the files stay there. File name does not matter, so a +1 counter would be just fine. Any thoughts on where to add the counter variable, or how? Thanks all!

edit: updated screenshot

Here's an example of how you could do this. You may need to first create a Counter variable that contains an integer if you don't already have one.

Example Macro.kmmacros (2.3 KB)

1 Like

No dice. If memory serves, the last time I did this (ages ago), I had to use the "i" function with Set Variable to Calculation, then yes, a +1 for the integer--or something like that.

A question: the purple folder button opens, as one would expect, a Finder window to pick the directory (in this case, a folder called "temp" on Desktop). But Save is grayed-out unless a value is placed in the Save As box, too.

If I do set a value for Save As, I the macro works for one iteration--saving to the value of the Save As. But the counter still doesn't work. So close though!

The macro I posted works fine for me, so without seeing the macro you're using, I have no idea what you could be doing differently that's causing it to fail. I can tell you that I didn't use the purple button, but just entered the path to the Desktop's temp folder manually. At any rate, I recommend uploading the actual macro you're using as well as a screenshot if you want further assistance. If you don't know how to do that, you can find instructions here: Forum [Keyboard Maestro Wiki]

1 Like

I was struck with an idea for, in my opinion, a better way of adding a counter than keeping track of the number in a variable, so I thought I'd post that here too for posterity. This macro counts the number of files in the designated folder and adds one onto the number appended to the file name automatically:

Save Screenshots with Counter.kmmacros (3.3 KB)