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

Duplicate and Open File Fail

Participant ,
Jun 28, 2016 Jun 28, 2016

Having an issue with this script.  It works fine when running it with the file open.  But when adding an open file command, Illustrator give me an MRAP error?? Am I doing something wrong?

// Global

    var idoc = activeDocument;

    var saveOutDirectory = (File ("MyDirectory"));

   

// Save Out

function saveFile() {

    for (var i = 0; i < idoc.dataSets.length; i++) {

        currentDataset = idoc.dataSets;

        currentDataset.display(); 

        idoc.saveAs(File (saveOutDirectory + "/" +  currentDataset.name +  "_MyFile.pdf"), myOpts);

    }

};

// Remove - Print Graphics and Artboards

function removePrintAB() {

    var artbs = idoc.artboards;

    for (var i = artbs.length-1 ; i >= 0; i--) {

        if (artbs.name != "MySpecialArtboard") {

            artbs.setActiveArtboardIndex(i);

            idoc.selectObjectsOnActiveArtboard();

            app.cut();

            artbs.remove();

    }}

};

// Duplicate Original File

var TempFile = (File (saveOutDirectory + "/" + idoc.name));

TempFile.copy (saveOutDirectory + "/" + "temp file.pdf" );

open(File (saveOutDirectory + "/" + "pellon_temp.pdf"));

removePrintAB();

saveFile();

TOPICS
Scripting
468
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

Valorous Hero , Jun 28, 2016 Jun 28, 2016

maybe it's because when you open the new file, you have to re-declare your 'idoc' as it may be referencing the previous file.

Translate
Adobe
Valorous Hero ,
Jun 28, 2016 Jun 28, 2016

maybe it's because when you open the new file, you have to re-declare your 'idoc' as it may be referencing the previous file.

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
Participant ,
Jun 28, 2016 Jun 28, 2016
LATEST

Dude, Really?   It worked.  Re-declare in the save out function.  Works perfect. Thanks one more time V.

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