Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with exporting document and generating an enumerated value error

New Here ,
Nov 01, 2009 Nov 01, 2009

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

TOPICS
Actions and scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guru , Nov 02, 2009 Nov 02, 2009

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

Translate
Adobe
Guru ,
Nov 02, 2009 Nov 02, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Nov 02, 2009 Nov 02, 2009

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

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guru ,
Nov 02, 2009 Nov 02, 2009
LATEST

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines