I'll post an updated version... If you are not opening the raw files as smart objects, I'll need to modify the previously linked script...
Edit: @Shlomit Heymann – here is the updated version for use with raw files from ACR which are not smart objects. Please let me know if there are any issues and or if it works OK for you:
/*
Remove Ending Hyphen Digit from ACR Files.jsx
Stephen Marsh, 26th April 2022, v1.0
https://community.adobe.com/t5/photoshop-ecosystem-discussions/cancel-suffix-number-addition-when-reopen-raw-filess-cr2/td-p/12904160
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/stop-photoshop-adding-number-suffixes-to-documents/m-p/12767371
Note: Use the Scripts Events Manager - Open Document event to automatically run this script when opening files from Adobe Camera Raw
*/
#target photoshop
// CHECK FOR OPEN DOCS
if (documents.length) {
// LOOP OVER OPEN FILES
for (var i = 0; i < documents.length; i++) {
activeDocument = documents[i];
// PROCESS FILES WITHOUT A FILENAME EXTENSION
if (/\.[^\.]+$/i.test(activeDocument.name)) {} else {
if (ExternalObject.AdobeXMPScript == undefined) ExternalObject.AdobeXMPScript = new ExternalObject('lib:AdobeXMPScript');
var xmp = new XMPMeta(activeDocument.xmpMetadata.rawData);
var crsMeta = xmp.getProperty(XMPConst.NS_CAMERA_RAW, "Version");
if (activeDocument.name.match(/-\d+$/) && activeDocument.activeLayer.isBackgroundLayer && activeDocument.layers.length === 1 && crsMeta !== undefined) {
var origDoc = activeDocument;
var docName = origDoc.name.replace(/-\d+$/, '');
origDoc.duplicate(docName, false);
origDoc.close(SaveOptions.DONOTSAVECHANGES);
// END OF SCRIPT NOTIFICATION
app.beep();
}
}
}
// ALERT IF NO DOCS OPEN
} else {
alert('You must have a document open!');
}
The script is intended to be used via the Script Events Manager for the Open Document event:
https://prepression.blogspot.com/2021/10/photoshop-script-events-manager.html
Saving JavaScript Source Code:
- Copy the code text to the clipboard
- Open a new blank file in a plain-text editor (not in a word processor)
- Paste the code in
- Save the text file as .txt
- Rename the file extension from .txt to .jsx
- Install or browse to the .jsx file to run (see below):
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html#Photoshop