Copy link to clipboard
Copied
Hi,
I've been using a script .jsx on Photoshop to add a text calc including the name of the file into my PSD file.
It isn't working since the release of Photoshop 24, I can only use it until Photoshop 23.5.5.
Actually, I include this script in an action to process a lot of images at once.
On Photoshop 24, the script creates a text calc with the name of the file I used to create the action, it isn't creating a calc with the name of the file he's processing,
Is there an update I need to do to my script ?
Here is the script i'm using :
/////////////////////////////////////////////////////////////////////////////
#target photoshop // Script dédié ‡ Photoshop
app.bringToFront(); // On place Photoshop au premier plan
displayDialogs = DialogModes.NO; // Désactivation des boites de dialogue
// Sauvegarde des unités de mesure en cours, et passage en pixels par défaut
var oRulerUnits = preferences.rulerUnits;
var oTypeUnits = preferences.typeUnits;
preferences.rulerUnits = Units.PIXELS;
preferences.typeUnits = TypeUnits.PIXELS;
try
{
var DocActif = activeDocument; // Document actif (image ouverte au premier plan)
// Définition d'une variable définissant une couleur blanche, que nous utiliseront plus loin
var colorBlanc = new SolidColor();
colorBlanc.rgb.red = 255;
colorBlanc.rgb.blue = 255;
colorBlanc.rgb.green = 255;
// On crée un nouveau calque texte
var oLayer = DocActif.artLayers.add();
oLayer.kind = LayerKind.TEXT; // Type de calque = calque de texte
oLayer.name = "IPTC - Description"; // Nom du calque
var oTextItem = oLayer.textItem; // On définit une variable qui permettra de simplifier les accès au calque de texte créé
oTextItem.font = "Century gothic"; // DÈfinition de la police
oTextItem.size = 14; // Définition de la taille de police
oTextItem.color = colorBlanc; // Définition de la couleur du texte
////////////////////////////////////////////////////////////////////////////
////////// ZONE MODIFIABLE (insertion de votre texte)
////////////////////////////////////////////////////////////////////////////
//////////
function noneExtension( fileName )
{
var Point = fileName.charAt(fileName.length-4);
var Point2 = fileName.charAt(fileName.length-3);
if ( Point == "." )
{
fileName = fileName.substring( 0, fileName.length-4);
} else if(Point == "." )
{
fileName = fileName.substring( 0, fileName.length-3);
}
return fileName;
}
// Pour créer un retour ‡ la ligne (parfois utile) insérer "\u000D"
// Insertion du nom du fichier
oTextItem.contents = noneExtension(DocActif.name);// Contenu du texte
//////////
//////////
////////////////////////////////////////////////////////////////////////////
// Centrage du calque de texte au milieu de la compo (par défaut)
var LargeurTexte = (oLayer.bounds[2] - oLayer.bounds[0]); // Largeur du calque de texte
var HauteurTexte = (oLayer.bounds[3] - oLayer.bounds[1]); // hauteur du calque de texte
oTextItem.position = [(DocActif.width-LargeurTexte) / 2, (DocActif.height-HauteurTexte) / 2];
}
catch(oErreur)
{
// Une erreur est survenue...
alert( "Une erreur est survenue : " + oErreur.description)
}
// Remise en place des unités de mesure initiales
preferences.rulerUnits = oRulerUnits;
preferences.typeUnits = oTypeUnits;
////////////////////////////////////////////////////////////
Thank you by advance,
Image Processor Pro isn't a standard script installed by default, you have to download it and install it yourself:
https://sourceforge.net/projects/ps-scripts/files/Image%20Processor%20Pro/v3_2%20betas/
Copy link to clipboard
Copied
Can you tell me more about how you are using the script? If I just run it (File > Scripts > Browse) it seems to work just fine. But you mention an action. Can you export that and provide it as well? I'm guessing that you are batch processing. So what happens is that the same file name gets added to every image?
Copy link to clipboard
Copied
Can you show a screenshot of the action with all steps expanded/visible and also show the batch settings?
Copy link to clipboard
Copied
Hello,
Thanks for your answer,
I was running the script using this path with Photoshop 23.5.5 :
File > Automate > Image Processor Pro
As I can't find this same feature on Photoshop 24, I'm trying this path :
File > Scripts > Image Processor
It seems like I can make the same action with this window
Here is an image of the settings of my action :
@BrettN That's it, the same file name is added to every image.
Thank you by advance,
Copy link to clipboard
Copied
Hello,
I've put a screenshot of my action in my BrettN's reply, if you want to check it. Here is a screenshot of my settings in Photoshop 24 :
And my settings in Photoshop 23.5.5 :
Copy link to clipboard
Copied
Image Processor Pro isn't a standard script installed by default, you have to download it and install it yourself:
https://sourceforge.net/projects/ps-scripts/files/Image%20Processor%20Pro/v3_2%20betas/
Copy link to clipboard
Copied
Thank you, this is the information I needed, the script is working now 😉