Hello,
I am working on a macro which at some point saves or exports the file I am working in. The file often already exists in the save directory.
Is there a way to save and specify replace if file exists, or if not give a small variant equivalent to a version number to the filename?
thanks very much for your time and help
If i understand you, you can check if the file exists, and if so, rename it with a version number.
Then save your new file.
You can keep a variable "version" that keeps increasing the version number, etc.
thank you very much !
I am very sorry: I am still having difficulty writing the macro.
I like your idea of version numbers
If I arrive after exporting at the screen depicted below, what is the next action on my macro.
thanks very much for your time and patience
I’m on vacation so I can’t answer too thoroughly, but I’d imagined it where, rather than renaming the file as you save, you can use the action I posted last week to rename the OLD file, then save your current file with the default name.
I’ll circle back when I’m back in town unless someone else beats me to it.
Thank you very much! I will work on our in the meantime.
Have a nice trip!!!
This is what I was imagining.
Then save your file with it's original name (in this case, file.pdf
). This will let you have a versioned history of changes and you'll never have to worry about overwriting. No need to do anything special with the save dialog. You'll have to set the variable "Version" to 0001 before these actions. I did it at the beginning of the macro and then disabled that Set Variable “Version” to Text “0001”
action.
This may be of interest to some people.
I created a macro on request that increments file versions. If you go back to a previous version and increment that, it will increment the increment.
For example, first round increments:
Test
Test - v.1
Test - v.2
Test - v.3
etc...
Then, if you increment Test - v.2:
Test - v.2
Test - v.2.1
Test - v.2.2
Test - v.2.3
etc...
It uses the Split Text plugin, as I'm no good with regex. If anyone can improve upon this, please do!
Incremental Save.kmmacros (50 KB)
NB: Some apps (Textedit and Preview for example) do that open-duplicate-in-another-window thing instead of opening a Save As dialog, so you'd need to modify the macro to account for this behaviour.
I'm trying to figure out the padding with zeros on this so it is v01 and not v.1.
Seems like this is what needed to change but not working.
%Variable%FileNamePart_01% - v0%Variable%Local__NewVersionNumber%
Yeah very weird when they implemented that back in Lion or so and having to add option to command+shift+s.
I had to remind myself why Apple did this and now I remember the keynote and them showing this in various apps as kind of a TimeMachine built into the files.
Apple changed the Save As behavior in OS X Lion (10.7), which was released in July 2011. The change was part of Apple's introduction of Auto Save and Versions features that were designed to modernize document handling.
The thinking behind this change had several aspects:
1. Simplify document management: Apple wanted to make file saving more intuitive by automatically saving work and creating versions, similar to how iOS handled documents.
2. Reduce data loss: The Auto Save feature meant documents were continuously saved without user intervention, helping prevent work loss if applications crashed.
3. Version control for everyone: The Versions feature allowed users to browse through document history and restore previous versions, similar to Time Machine but for individual files.
When they changed this, they replaced the traditional Save As (Command+Shift+S) with "Duplicate" in the File menu, requiring users to duplicate a document first and then save the duplicate with a new name. This change confused many long-time Mac users who were accustomed to the traditional Save As workflow.
After significant user feedback, Apple eventually brought back the traditional Save As command in OS X Mountain Lion (10.8), accessible through the Option+Command+Shift+S keyboard shortcut or by holding the Option key while viewing the File menu, which would change "Duplicate" to "Save As."
The change remains somewhat controversial among Mac power users, as it represented Apple prioritizing a conceptually simpler model for new users over the established workflows that experienced users had grown accustomed to.
Have you played with the %CalculateFormat%
token?
...or using the "With Format" option in the "Set Variable to Calculation" action?
Thank you I remembered reading about those and I have used those before but only once or twice and it escaped me where I saw it. Thank you, I will play with those.