Wrong options, cant open - Error 8000

New Here ,
Jan 19, 2012 Jan 19, 2012

Copy link to clipboard

Copied

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?

TOPICS
Actions and scripting

Views

689

Likes

Translate

Translate

Report

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 , Jan 19, 2012 Jan 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?

Likes

Translate

Translate
New Here ,
Jan 19, 2012 Jan 19, 2012

Copy link to clipboard

Copied

Solved problem myself,

i had to use PDFOpenOptions object instead of EPSOpenOptions object.

Likes

Translate

Translate

Report

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 ,
Jan 19, 2012 Jan 19, 2012

Copy link to clipboard

Copied

LATEST

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?

Likes

Translate

Translate

Report

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