Save with an incremented file name

Is it possible for me to create a macro that will save a document, but each time I run the macro, increment a counter in that file name? I want to save 5 documents with a macro and automatically have the documents named “file1”, “file2”, “file3”, “file4”, “file5”

How can I do this?

Hey Steve,

Please be more specific.

What app?

Any app?

Under what circumstances?

You want to save the same document as a revision to a different file?

Your last sentence suggests you want to save to 5 documents at a time.

Your first sentence suggests that you want to save a revision each time you activate the macro.

Give us some more info, and we’ll see if we can help you out.

-Chris

Specifically I want to do this in grab, I want it to happen every time I press the keyboard shortcut, I want one file to be saved every time I press the shortcut key. If I press the shortcut key 5 times I want to end up with file1, file2, file3, file4, and file5. If I press the shortcut key 3 times I just want file1, file2, file3. I can reset the counter with another macro so that is not a problem. Does that make better sense?

Hey Steve,

Keyboard Maestro has it’s own screenshot mechanism, so you can create a macro to do exactly what you want.

I wouldn’t want to try to use Grab.app for that.

-Chris

Indeed. WAYRTTD? Keyboard Maestro can take screenshots in a variety of ways, and save them to files with whatever named and incrementing numbers you want.

1 Like

Learning something new about KM every day! :smile:

1 Like

I looked at the screen capture capabilities of KBM and it looks like I am forced to take a capture of the entire screen. That is not what I want to do, I want to capture a selection of the screen that I define by pixel locations. Also, I see no way to save this capture to a file name that increments. Can someone please explain to me how this can be done?

Are you using Keyboard Maestro 7? Version 7 lets you configure the Screen Capture in a variety of ways:

Don't try the "Area" option until 7.0.1 though, but it looks like this:

However, before 7 you could still crop the resulting image:

And then you can write the image to a file:

Hey Steve,

Peter is using a date as an increment, but you can easily drop a number in a variable — do a calculation on it — saving to itself — and use a token for the new value.

-Chris

1 Like

I am not using version 7. that explains a lot. I will check out the upgrade. Thanks for your message.