Script to remove 'copy' from crop and straightened images.
Hi I'm looking for a script that removes the word ' copy,' from files that have been cropped and straightened. Thanks.
Hi I'm looking for a script that removes the word ' copy,' from files that have been cropped and straightened. Thanks.
I could rename afterwards using bridge or lupas rename which I have been doing but was hoping there was a way to script it in the action.
By @Joseph Brown
After the Action step for Crop and Straighten Photos, record the following script into the Action:
/*
Remove Copy from Open Doc Names.jsx
Stephen Marsh, 9th October 2022, v1.0
https://community.adobe.com/t5/photoshop-ecosystem-discussions/script-to-remove-copy-from-crop-and-straightened-images/td-p/13253044
Based on:
https://community.adobe.com/t5/photoshop-ecosystem-discussions/cancel-suffix-number-addition-when-reopen-raw-filess-cr2/td-p/12904160
https://community.adobe.com/t5/photoshop-ecosystem-discussions/stop-photoshop-adding-number-suffixes-to-documents/m-p/12767371
*/
#target photoshop
// CHECK FOR OPEN DOCS
if (documents.length) {
removeCopy();
// WHY?
removeCopy();
// END OF SCRIPT
app.beep();
// ALERT IF NO DOCS OPEN
} else {
alert('You must have a document open!');
}
function removeCopy() {
try {
// IGNORE SAVED FILES
app.activeDocument.path;
} catch (e) {
// LOOP OVER OPEN UNSAVED DOCS
for (var i = 0; i < documents.length; i++) {
activeDocument = documents[i];
// PROCESS DOCS WITHOUT A FILENAME EXTENSION
if (/\.[^\.]+$/i.test(activeDocument.name)) {} else {
// PROCESS DOCS CONTAINING ' copy'
if (activeDocument.name.match(/ copy/)) {
var origDoc = activeDocument;
var docName = origDoc.name.replace(/ copy/, '');
origDoc.duplicate(docName, false);
origDoc.close(SaveOptions.DONOTSAVECHANGES);
}
}
}
}
}
https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.