Saving PNGs with suffixes as part of an action

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

mdh7382
Posts: 1
Joined: Mon Feb 27, 2017 10:24 am

Saving PNGs with suffixes as part of an action

Post by mdh7382 »

Hi all,

Apologies if this topic has come up before…

As part of a work project, I need to save transparent PNGs of our products in a new range of colours.

Currently, my action process is as follows:

SAVE (original product colour)
Change product colour to blue
SAVE
Change product colour to red
SAVE
etc.

At present, the save command overwrites each previous file. What I’d really like is a script which will save each item with the following suffix: FILENAME_WHITE, FILENAME_BLUE, etc.

Any help would be massively appreciated!
User avatar
txuku
Posts: 136
Joined: Thu Jan 01, 1970 12:00 am

Re: Saving PNGs with suffixes as part of an action

Post by txuku »

Bonjour

Something like this :

Code: Select all

//NomImageCouleur.jsx
var docRef = app.activeDocument
var docName = docRef.name;
var COUL = new Array( "BLUE", "RED", "WHITE" ); // ajouter des couleurs ....
//alert(docName);

newName = docName.slice(0,-4);

//alert(newName);

for (i = 0; i<COUL.length; i++ )
{
newNameFinal = newName + "_" + COUL[i];
//alert(newNameFinal);
FileName = newNameFinal;
//FUNCTION savePNG( Filename ) = lancer les sauvegardes avec les nouveaux noms
}