Quantcast
Channel: Adobe Community: Message List - Photoshop Scripting
Viewing all articles
Browse latest Browse all 27456

Re: Auto Rename Path

$
0
0

I'm still unsure about what exactly you want to do.  Do you want just the very first path name renamed to the one you selected?  Here are some changes I would make to the script:

 

Turn off dialogs.

Add PSD save options - I'm assuming you want them saved as psd.

Add dialog to select a save to folder

Get rid of second loop that goes through the paths.

Add a try/catch block so you don't get error messages

Add a save as to save the file to a new location.

Change SAVECHANGES to DONOTSAVECHANGES to get rid of extra dialog that you don't need.

 

 

#target photoshop

 

app.displayDialogs = DialogModes.NO;

var psdOptions = new PhotoshopSaveOptions()

psdOptions.layers = true

       

var selFolder = Folder.selectDialog( 'Location of images to process...' );

 

var saveFolder = Folder.selectDialog('Path for save folder');

 

var files = selFolder.getFiles ( /\.jpg$/i );// may need to edit for different formats;

var newPathName = prompt ("Pfadnamen eintragen", 'Proll', "Pfad 1"); 

 

   for(var f = 0; f < files.length; f++ ){

      var doc = app.open( files[f] );

      var numberOfPaths = doc.pathItems.length;

      try{

         if( doc.pathItems[0].kind == PathKind.NORMALPATH && newPathName !=  doc.pathItems[0].name ) doc.pathItems[0].name =  newPathName;

      }//end try

      catch(e){}

         }//end for loop

   doc.saveAs (new File(saveFolder +'/' + doc.name), psdOptions)

   doc.close(SaveOptions.DONOTSAVECHANGES);

   }


Viewing all articles
Browse latest Browse all 27456


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>