Skip to main content
Participant
February 5, 2020
Question

Crop and Straighten Photos - file naming

  • February 5, 2020
  • 3 replies
  • 559 views

I am using the Automate > Crop and Straighten Photos on a file with multiple scanned photos in it.  Photoshop is beautifully creating 2 or more files with the separated photos in them.  The only problem is that the first one has the suffix 'copy' and then the rest 'copy 2', 'copy 3' etc.  When sorted in the windows file system, 'copy' comes last and I want it first, so that the ordering of the images matches my original scan.  Is there any way to name this first copy 'copy 1'?

Thanks.

This topic has been closed for replies.

3 replies

Stephen Marsh
Community Expert
Community Expert
February 6, 2020

It appears that CC2020 does not like the code to run the Crop and Straighten Photos plugin generated in CC2019...

 

The expedient appraoch is to simply remove the first block of code from my previous script, so that you are left with this as the final code:

 

 

var docName = app.activeDocument.name;
var origDoc = app.activeDocument;
origDoc.duplicate(docName + ' 1');
origDoc.close(SaveOptions.DONOTSAVECHANGES);

 

 

Then create an action and insert the Crop and Straighten Photos menu command into the action. Then record the playback of the script into the action (either as an installed or browsed script):

 

 

Then run the combined call of the plugin and the script from the combined 2-step action as illustrated above.

 

Keep in mind that it is only the FIRST file generated from Crop and Straighten Photos that will be renamed, if you have 11 images on the scan you will get something like this:

 

scan copy 1

scan copy 2

scan copy 3

scan copy 4

scan copy 5

scan copy 6

scan copy 7

scan copy 8

scan copy 9

scan copy 10

scan copy 11

 

Not having leading zero padding before the single digits may make the sorting incorrect for digits 1-9?

 

So you may still need to do a Bridge Batch Rename to sort the mess later anyway...

Participant
February 6, 2020

Thanks so much Stephen.  That worked perfectly & will make my task so much easier 🙂  I won't have more than 9 photos in a file so the lack of zero padding will not be an issue.  

Stephen Marsh
Community Expert
Community Expert
February 5, 2020

Try this script:

 

 

//community.adobe.com/t5/photoshop/crop-and-straighten-photos-file-naming/m-p/10904015
// Add ' 1' to first doc created by Crop and Straighten Photos

#target photoshop

CropPhotosAuto();
function CropPhotosAuto() {
	var s2t = function (s) {
		return app.stringIDToTypeID(s);
	};
	executeAction( s2t( "CropPhotosAuto0001" ), undefined, DialogModes.NO );
}

var docName = app.activeDocument.name;
var origDoc = app.activeDocument;
origDoc.duplicate(docName + ' 1');
origDoc.close(SaveOptions.DONOTSAVECHANGES);

 

 

https://prepression.blogspot.com/2017/11/downloading-and-installing-adobe-scripts.html

Participant
February 6, 2020

Thanks for this Stephen.  I really appreciate your help. 

I'm new to scripts, so I'm not sure how to debug this error that I got.  I am using Photoshop CC 20.0.6 release.

 

 

Stephen Marsh
Community Expert
Community Expert
February 5, 2020

I don't understand, what is the problem with manually renaming a single file?

Participant
February 6, 2020

Hi Stephen.  Once I get this working, I want to process 100s of files in a batch, so there will be 100s to rename.