Skip to main content
Participant
Jan 19, 2012 10:26 AM UTC
Answered

Wrong options, cant open - Error 8000

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 is closed to new replies. Start a new post to keep the conversation going.
Muppet MarkCorrect answer
Inspiring
Jan 19, 2012 10:53 AM UTC

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
Jan 19, 2012 10:53 AM UTC

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?

Translate
Participant
Jan 19, 2012 10:51 AM UTC

Solved problem myself,

i had to use PDFOpenOptions object instead of EPSOpenOptions object.

Translate