Incremental Save As

Hi,

Very new to KM, so sorry if this is simple! I'm trying to create a macro that allows me to save versions of an applications project (Ableton), with an incremental number at the end of each save.

I'm very confused as to how to get KM to read the original saved name in the 'Save As' dialogue, and then add the number onto the end. And the delete that number and add the next next time I run the macro etc.

Would anyone be able to explain how to do this?

The trouble with Ableton is that it doesn't allow you to use system hotkeys while in the Save dialog, so you can't, for example, copy the current filename.

I've come up with a workaround that gets the current project name from the window title. It will of course only work if the standard Ableton window is frontmost, as the second window doesn't have a title. If required, I can use a bit of applescript to make getting the window name possible regardless of which window is in focus.

I saved a project as "Test" and the resultant window title was "Test [Test]". I'm not sure why there's a duplicate of the name in square brackets, but I removed it using regex.

I'm sure someone else could make this a bit more efficient, but it's worked in my testing. As I'm so crap with regex, I opted for the Split Text plugin for part of this.

Incremental Save.kmmacros (39 KB)

Macro screenshot

In use:

Hit ⇧⌘S. If there's no existing version number in the project title, it will add " - v.1". If there is, it will increment it.

Thanks for this. Been trying to figure this out all day.

I've ran your macro, works great the first time, but doesn't want to go past v.1. Just getting a bleep and then nothing. Is there something I need to set up within the macro?

I think it might be split text? I don't seem to be able to edit that, sorry if I'm missing something obvious!

Screenshot 2022-04-11 at 17.03.53

Installed Split Text. Sorted. Thanks so much for this, really appreciate it.

1 Like

Great, glad it works! Just be aware that if you open a previous version and then save-as, it will increment it from that point.

So "Test - v.3" would try to save as "Test - v.4" even if v.4 already exists. We could come up with a workaround, but as long as you're aware of it, it's probably fine to go old-skool and manually save-as in those instances.

Couldn't help myself. Here's a version that gets the current filename from the "Open Recent Set" menu item instead of the window title. This means it will work regardless of which window is in focus.

Incremental Save.kmmacros (41 KB)

Macro screenshot

1 Like

Amazing, thank you!

Maybe it's possible to look in the folder the project is saving to and find the highest number when you're on an older version? In all honesty it doesn't seem to be too much of a problem just doing it manually. It kicks up an error message, so no damage can be done I don't think. Might actually be useful to remember you're editing an older version.

Again, massively appreciated. Thanks.

Actually, would it be possible for it to add a '.1' if it encounters that error message? So if you're editing an older version and save, it starts incrementing from that versions number, along with .1, .2 etc? Not needed at all but would be handy.

Okay, how about this?

Incremental Save.kmmacros (44 KB)

Macro screenshot

1 Like

Amazing, thank you. I will try it out tomorrow. The emoji on increment increments tells me it's going to be good.

Thanks again for your help with this, I've got a lot to learn!

2 Likes

Me too bud! I was an absolute beginner last summer, and I've only got the basics down, but you can do a lot with those and some clarity of purpose. Be warned: it does become quite addictive and you may find yourself, like me, checking the forum regularly, looking for new challenges that you feel might be within your modest skillset to achieve. It's oddly rewarding!

3 Likes

Definitely. I've had it for a while, but only needed it for a specific thing. Just got the new Metagrid Pro and yeah, can feel the addiction coming on. Mega useful.

The increment increments incremental works great apart from one small thing. It adds the subsequent incremental to the first number instead of the second. So it goes 2.1 instead of 1.2. Tried to figure it out, but quickly broke it. Which part should I be looking at?

@jon83 Ah yes you're right! I only tested as far as the first sub-increment (v.x.1). Silly me.

Try this.

Incremental Save.kmmacros (51 KB)

Macro screenshot

2 Likes

Works perfect! Thanks again, much appreciated.

1 Like