Copy link to clipboard
Copied
Can anyone help me figure out why I cannot get this script to export the document and save it for the web?
I keep getting the same frustrating "Enumerated Value expected".
here is the script thus far:
/**
* attempting to create a script to insert names automatically within photoshop cs2. Similar to the PSP.
*/
tag = app.activeDocument;
var lee = ["Barb","Belle","Betty","Carmel","Christy","Connie",
"Debbie","Debra","Denise","Diamond","Dolceluna","Irene","Jacqui"];
//determine if active layer is a text layer or not.
if(tag.isBackground == true){
alert("this is a background layer and cannot be changed.");
}
else{
alert("this is the name layer.")
for(i=0;i<lee.length;i++){
tag.activeLayer.textItem.contents = lee;
var options = new ExportOptionsSaveForWeb();
options.format = SaveDocumentType.PNG-24;
options.interlaced = false;
options.PNG8= false;
var fName = lee;
var newName = fName+'-'+tag.name+'.png';
alert(newName);
//EXPORT DOCUMENT KEEPS GENERATING ENUMBERATED VALUE EXPECTED
// web.matte = MatteType.NONE;
tag.exportDocument(File(tag.path + '/' + newName),ExportType.SAVEFORWEB,options);
} // closes for loop
}// end of else statement
That is because you have the format wrong which changes it from an enumerated value to a number.
options.format = SaveDocumentType.PNG;// set the format
options.PNG8= false;// true for png-8 or false for png-24
Copy link to clipboard
Copied
That is because you have the format wrong which changes it from an enumerated value to a number.
options.format = SaveDocumentType.PNG;// set the format
options.PNG8= false;// true for png-8 or false for png-24
Copy link to clipboard
Copied
Perfect. I was reading the javascript guide and it said you can save as png-24.
That's it all it took.
Thank you so much
Anne
Copy link to clipboard
Copied
Yes the guide is misleading. It says 'For this property, only COMPUSERVEGIF, JPEG, PNG-8, PNG-24, and BMP are supported.'
It really should say 'For this property, only COMPUSERVEGIF, JPEG, PNG, and BMP are supported.'
But if you look under SaveDocumentType you will not find PNG-8 or PNG-24 listed in the values.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now