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

Scripting

New Here ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

I everyone! i'm knew to this forum and i would like ti know if anyone would know how to run a batch of jacascript in inDesign.

Thank in advance

TOPICS
Scripting

Views

966

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
Community Expert ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

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
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

[ Moved the discussion here for a better response ]

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
New Here ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

Hi' how do i run a batch of script in javascript???

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
Contributor ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

They could call each other in a chain (which is an incovenient approach because you'd have to edit each one) or you could write a new script to call each of them in turn.

Here's some snippets of code that should help. It runs all the scripts in a folder.

if (scriptsFolder.exists) {

          var myScripts = scriptsFolder.getFiles(checkForScripts);

          myScripts.sort(); // Force scripts to run in JS alphabetical order

          for (var scriptIndex = 0; myScripts.length > scriptIndex; scriptIndex++) {

                    app.doScript(myScripts[scriptIndex]);

          } // end for

}

...

function checkForScripts(aFile) {

          if (aFile instanceof Folder) return false;

          var extn = aFile.name.slice(aFile.name.lastIndexOf("."));

          if (extn === aFile.name) return false; // file name lacks extension;

          switch (extn) {

               case ".jsx" : case ".jsxbin" : return true;

               default : return false;

          }

} // end checkForScripts;

To use that code you'll need to put it into the context of a larger script that at the very least provides a value for scriptsFolder. The ... I use to separate the function from the other code will need to go in order for you to run the code.

Dave

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
New Here ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

Thank buddy!

I¹l try this...

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
Advocate ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

I just fixed a stupid typo. Make sure you have the latest.

PS: I am the other guy -- I'm acknowledging my own stupidity, not calling someone else names. My computers insist on my having two different personalities here depending on which one I use.

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
New Here ,
Sep 27, 2013 Sep 27, 2013

Copy link to clipboard

Copied

LATEST

ok got it!

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