Rename opening file

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

klevteev
Posts: 17
Joined: Wed Nov 06, 2019 1:22 pm

Rename opening file

Post by klevteev »

Hello
is it possible to assign a different file name to an open document?

if I make a duplicate, I can do so, but if I still want to rename the original file? not save, only rename...

Code: Select all

var aDoc = app.activeDocument;
var fileName = aDoc.name.slice(".")

var WF = Math.round(aDoc.width);
var HF = Math.round(aDoc.height);

var theCopy = aDoc.duplicate ("Face" + "_" + WF +"x" + HF + "mm_" + fileName, true);
syntax - .rename? .getByName?

How can I do this?
User avatar
Kukurykus
Posts: 528
Joined: Mon Jul 25, 2016 12:36 pm

Re: Rename opening file

Post by Kukurykus »

Without saving you can't.
klevteev
Posts: 17
Joined: Wed Nov 06, 2019 1:22 pm

Re: Rename opening file

Post by klevteev »

okay, so duplicate rules)