Quantcast
Channel: Adobe Community : Popular Discussions - Photoshop Scripting
Viewing all articles
Browse latest Browse all 12244

Replace document name

$
0
0

How could I replace a open document name with a new name?

 

I have a script that creates the new name but I can't figure out how to send the new name back to photoshop replacing the open document name.

 

Here is the current script:

*********************

layerN = activeDocument.activeLayer.name

var doc = app.activeDocument

var fname = doc.name.split(".")

var fname = fname[0]

 

 

var newDoc = doc.duplicate(fname+layerN,true)

//var newDoc = (fname+layerN,true)

 

 

app.activeDocument.name = newDoc

newDoc.flatten();

***************************

Right now this one makes a duplicate of the original document with the document name like I want, but I would rather just rename the original document instead of making a duplicate.

 

Any help is appreciated.


Viewing all articles
Browse latest Browse all 12244

Trending Articles



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