Skip to main content
Participant
January 19, 2012
Answered

Wrong options, cant open - Error 8000

  • January 19, 2012
  • 2 replies
  • 1727 views

Hello,

i am creating a script to export .ai files to .png in different sizes and resolutions.

Im getting always an error that the options are wrong, incorrect.

Heres the invalid part of my code:

function createFolderAndSave(file,name,size,resolution)

{   

    // Create a EPS option object [height & width are doc size]

    var epsOpenOptions = new EPSOpenOptions;

    epsOpenOptions.antiAlias = true;

    epsOpenOptions.height = size[0];

    epsOpenOptions.width = size[1];

    epsOpenOptions.mode = OpenDocumentMode.RGB;

    epsOpenOptions.resolution = resolution;

    epsOpenOptions.page = 1;

    epsOpenOptions.constrainProportions = false;

   

    open(file , epsOpenOptions); // error

    var doc = app.activeDocument;

   

    var replacer = new RegExp("-","g");

    var docName = "ic_" + doc.name.replace(replacer,"_");

    var myFolder = new Folder(destinationPath + "\\" + docName);

    if(!myFolder.exists) myFolder.create();

    var myFolder = new Folder(destinationPath + "\\" + docName + "\\" + name);

    if(!myFolder.exists) myFolder.create();

   

    doc.changeMode(ChangeMode.RGB);

   

    var pngOptions = new PNGSaveOptions();

    pngOptions.interlaced = true;

    $.writeln(destinationPath + "\\" + docName + "\\" + name + "\\" + docName);

    doc.saveAs( File( destinationPath + "\\" + docName + "\\" + name + "\\" + docName ) , pngOptions, false, Extension.LOWERCASE);

}

Maybe someone have an idea to solve this problem?

This topic has been closed for replies.
Correct answer Muppet Mark

An Illustrator *.ai file for this purpose should be treated as PDF in format… In think most PDF readers will open them… So just swap your open options… Should you need the change mode? Your open options should have sorted this?

2 replies

Muppet MarkCorrect answer
Inspiring
January 19, 2012

An Illustrator *.ai file for this purpose should be treated as PDF in format… In think most PDF readers will open them… So just swap your open options… Should you need the change mode? Your open options should have sorted this?

Participant
January 19, 2012

Solved problem myself,

i had to use PDFOpenOptions object instead of EPSOpenOptions object.