When saving a picture, it shoud be possibele to save it with a unique (random) name. Then when making a save action, it won't overwrite the original file.
A random name could be scripted if you need this now.
I believe that Photoshop really needs the ability to add "variable tokens" into the filename. The tokens are not literal characters, they are metacharacters that the save naming routine would "translate" into literal characters. The token could also offer parameters, such as the number of digits required.
As an example, the filename entry could be:
My great digital painting_\\random-digits,6\\
And when saved as say a JPEG the result would be:
My great digital painting_542876.jpg
In this example, I have used illegal filename characters \\ as "reserved" special characters to designate the token. There could be a checkbox to enable tokens, or a preference setting. It would be helpful that there was a option in the GUI to select and insert the token rather than relying on the user to type it correctly.
That is correct, the script was designed to offer an interactive save, defaulting to PSD.
The following code will save a JPEG to the open document path or ask for a save location if the source file is unsaved. Existing files with the same name will be overwritten, as pseudo-random doesn't guarantee a unique name.
#target photoshop
try {
var outputPath = app.activeDocument.path.fsName;
} catch (e) {
var outputPath = Folder.selectDialog("Unsaved file, select the output folder:");
}
var pseudoRandomDigits = (Math.random() * 1e10);
pseudoRandomDigits = Math.round(pseudoRandomDigits);
var docName = app.activeDocument.name.replace(/\.[^\.]+$/, '');
var saveOptions = new JPEGSaveOptions();
saveOptions.embedColorProfile = true;
saveOptions.formatOptions = FormatOptions.STANDARDBASELINE;
saveOptions.matte = MatteType.NONE;
saveOptions.quality = 10;
app.activeDocument.saveAs(File(outputPath + "/" + docName + "_" + pseudoRandomDigits + ".jpg"), saveOptions, true);