Skip to main content
Participant
April 21, 2012
Answered

JS scripted needed to add custom text plus filename to file info in document title

  • April 21, 2012
  • 1 reply
  • 1171 views

Would greatly appreciate any help with this one...

JS script to add custom text plus filename to file info in document title

many thanks

This topic has been closed for replies.
Correct answer fotoeros

Super :O)

I have a folder of say 50 images and I want to run a JS script batch

example in the document title :  image Nr 81205

custom text is "image Nr" +  file name "81205"

activeDocument.info.title =" image Nr" + decodeURI(activeDocument.name);

would this be correct without seening the file ext

many thanks

1 reply

Paul Riggott
Inspiring
April 21, 2012

It depends on if you want to add the information on an open document or add the information without opening.

This example will add the information to an open document.

activeDocument.info.title = decodeURI(activeDocument.name) + " what ever else you want to add";

fotoerosAuthorCorrect answer
Participant
April 21, 2012

Super :O)

I have a folder of say 50 images and I want to run a JS script batch

example in the document title :  image Nr 81205

custom text is "image Nr" +  file name "81205"

activeDocument.info.title =" image Nr" + decodeURI(activeDocument.name);

would this be correct without seening the file ext

many thanks

Paul Riggott
Inspiring
April 21, 2012

Without the extension you can use...

activeDocument.info.title = " image Nr " + decodeURI(activeDocument.name.replace(/\.[^\.]+$/, ''));