2 Replies Latest reply on Oct 2, 2011 10:54 AM by Harbs.

    Execute my .jsx script from .vbs (without opening ExtendScript)

    jmituzas Level 1

      First of all have created a working datamerge script:

       

      function main(){

          mySnippet ();

          myTeardown();

      }

      //<setup>

      //<snippet>

      function mySnippet(){

      // automate datamerge

      var myDocument = app.open(File("P:/RxCut/In Design Implementation/build/automate/automate.indd"));

      var myDataSource = File("P:/RxCut/In Design Implementation/build/automate/automate.txt");

       

       

      myDocument.dataMergeProperties.selectDataSource(myDataSource);

      myDocument.dataMergeProperties.mergeRecords();

      myDocument=myDocument.save("P:/RxCut/In Design Implementation/build/automate/AutomatedMerged.indd");

      app.activeDocument.save(new File("P:/RxCut/In Design Implementation/build/automate/AutomatedMerged2.indd"));

      myDocument.close();

      }

       

       

      //</snippet>

      //<teardown>

      function myTeardown(){

      }

       

       

      This runs great as expected!

      Now for the next step, don't know if this is even possible?

       

      Would like to execute this jsx script without having to use InDesign and goto scripts, then finding the script and then executing the script from inside of InDesign.

       

      I have tried the following which I have found in these forums, but was written for CS2 and got nothing but errors when running in CS5:

       

      Set myInDesign = CreateObject("InDesign.Application.CS5")

      Msgbox("This message from Vbscript")

       

       

      myJavaScript = "C:\Program Files\Adobe\Adobe InDesign CS5\Scripts\Scripts Panel\test2.jsx"

       

       

      myInDesign.DoScript myJavaScript

       

       

      I would like to in the future be able to create a web form for users to input data for the data.txt file then click submit and it run for me.

       

      Please help me automate this process.

      Thanks in advance,

      Joe