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

Urgent Help Scripting

Community Beginner ,
May 31, 2016 May 31, 2016

Copy link to clipboard

Copied

  I am a beginner at scripting, coding, and web design. I have been having questions regarding developing an Adobe Script that will Automatically open a PDF file I have (created in Illustrator CC 2015), Automatically change the name of two swatches to new names I have, then automatically Save with same file name plus "_Z.PDF" at the end and close the file.

                                                                            

Below is the code i developed with help from experts. It is designed for a Mac computer and is opened using ESTK. When I try activating, it says there is still an error in the part :  var doc = app.open(f); What should I do about this? I have it underlined below too in bold italics.

function test()

{

    // 1)

    var thePath = "~/Desktop/";

    var theFile = "test_swatch_change.pdf";

    var f = new File(thePath + theFile);

    var newFileName = theFile.replace(/\.pdf$/, "_Z.pdf");

   var doc = app.open(f);

    // 2)

    doc.swatches.getByName('Kiss Cut').name = ('CutContourKiss-cut');

    doc.swatches.getByName('Through Cut').name = ('CutContourThru-cut');

    // 3)

    var saveFile = new File(thePath + newFileName);

    var saveOpts = new PDFSaveOptions();

  

    doc.saveAs(saveFile, saveOpts);

    // 4)

    doc.close();

}

test();

TOPICS
Scripting

Views

243

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
Adobe
Enthusiast ,
Jun 01, 2016 Jun 01, 2016

Copy link to clipboard

Copied

LATEST

You should set target application to Illustrator, not ExtendScript Toolkit.

Or you can add one line at the beginning:

#target illustrator

this will automatic set target to Illustrator for you.

Votes

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