Skip to main content
AG_Ps_100
Inspiring
April 7, 2019
Answered

Save for Web Metadata Scripting

  • April 7, 2019
  • 1 reply
  • 1903 views

Hello everyone,

I have this script to save for web (for JPG)

I want to add in my script the line where I can choose the different Metadata options (there are 5 options).

If it can be done without ScriptListener it's even better.

here is my script:

var Name = app.activeDocument.name;

if (Name.indexOf(".") != -1 ) Name=Name.substr(0,Name.lastIndexOf("."));

filePath = app.activeDocument.path + '/' + Name + '.jpg';                    //filePath has also the name in it and also the extension

var options = new ExportOptionsSaveForWeb();

options.quality = 50;

options.format = SaveDocumentType.JPEG;

options.optimized = true;

var doc = app.activeDocument

doc.exportDocument(File(filePath),ExportType.SAVEFORWEB,options);

This topic has been closed for replies.
Correct answer Stephen Marsh

No, you could search the forums...

Here is a screenshot comparing ALL metadata to NO metadata, with differences highlighted. I have not tried plugging the code in or running it through Clean SL first, so more lines of code than the two shown below may be required.

EDIT: Try these –

Include Metadata in Save for Web JPEGS

Re: Setting SaveForWeb Metadata option

1 reply

Stephen Marsh
Community Expert
Community Expert
April 7, 2019

AFAIK this is one of the black holes in DOM code, so script listener is the only option that I am aware of.

AG_Ps_100
AG_Ps_100Author
Inspiring
April 7, 2019

Oh ok thank you.

Do you have by chance an already made ScriptListener lines so i can add to my script?

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
April 7, 2019

No, you could search the forums...

Here is a screenshot comparing ALL metadata to NO metadata, with differences highlighted. I have not tried plugging the code in or running it through Clean SL first, so more lines of code than the two shown below may be required.

EDIT: Try these –

Include Metadata in Save for Web JPEGS

Re: Setting SaveForWeb Metadata option