Highlighted

Script needed for renaming active.Document without saving or duplicating

New Here ,
Nov 04, 2020

Copy link to clipboard

Copied

Can I please get help with creating a script that will give a prompt to rename an open file in Photoshop without saving or duplicating?

 

I have the below script which works great when duplicating, but I'm not sure how to create a new one with the above requirements.

 

#target photoshop

// Dupe Original File with -Suffix.jsx
var origDoc = app.activeDocument
var baseName = origDoc.name.replace(/\.[^\.]+$/, '');
var sep = String ("-");
var suffix = prompt("Enter Suffix:", "Suffix");
var dupeName = baseName + sep + suffix;
origDoc.duplicate((dupeName), true);
// Optional Step: remove the // comment characters to enable
origDoc.close(SaveOptions.DONOTSAVECHANGES); // (SaveOptions.SAVECHANGES)

 

TOPICS
Actions and scripting

Views

47

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Script needed for renaming active.Document without saving or duplicating

New Here ,
Nov 04, 2020

Copy link to clipboard

Copied

Can I please get help with creating a script that will give a prompt to rename an open file in Photoshop without saving or duplicating?

 

I have the below script which works great when duplicating, but I'm not sure how to create a new one with the above requirements.

 

#target photoshop

// Dupe Original File with -Suffix.jsx
var origDoc = app.activeDocument
var baseName = origDoc.name.replace(/\.[^\.]+$/, '');
var sep = String ("-");
var suffix = prompt("Enter Suffix:", "Suffix");
var dupeName = baseName + sep + suffix;
origDoc.duplicate((dupeName), true);
// Optional Step: remove the // comment characters to enable
origDoc.close(SaveOptions.DONOTSAVECHANGES); // (SaveOptions.SAVECHANGES)

 

TOPICS
Actions and scripting

Views

48

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Nov 04, 2020 0
Adobe Community Professional ,
Nov 04, 2020

Copy link to clipboard

Copied

Hi @Sara5C33,

I don't understand your requirement. How are we supposed to change the file's name if we don't save or duplicate it? Can you explain what you intend to do if you had to do it manually without a script?

-Manan

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 04, 2020 1
Adobe Community Professional ,
Nov 05, 2020

Copy link to clipboard

Copied

+1

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Nov 05, 2020 0