3 Replies Latest reply on Nov 28, 2012 5:24 AM by Vamitul

    Syntax error to run a javaScript

    Bill joy

      Hi all

      I want to run a JavaScript using AppleScript do script method.

      First I create a document using

       

      tell application "Adobe InDesign CS5.5"

                set myDocument to make document

      end tell


      Now I run this script


      set ScriptPath to alias "HD:private:var:root:Documents:Adobe Scripts:Source1.jsx"

      tell application "Adobe InDesign CS5.5" 

        do script ScriptPath language javascript

      end tell

       

      But it give error

      error "Adobe InDesign CS5.5 got an error: Syntax error" number 8

       

      I also try :

       

      set ScriptPath to alias "HD:private:var:root:Documents:Adobe Scripts:Source1.jsx"

      tell application "Adobe InDesign CS5.5"

                set myDocument to make document

        do script ScriptPath language javascript

      end tell


      No compile error

      At run time give same error "Adobe InDesign CS5.5 got an error: Syntax error" number 8

       

      If I create document using this:


      tell application "Adobe InDesign CS5.5"

        set myDocument to make document

      end tell


      and run Source1.jsx using Extend Script Toolkit CS5.5 then script run sucessfully.

       

      My Java Script is :

       

      #target indesign

      var myDocument = app.activeDocument;

      with(myDocument.documentPreferences)

      {

          pageHeight= "11i";

          pageWidth ="8.5i";

          facingPages=false;

          pageOrientation=PageOrientation.portrait;

          pagesPerDocument=1;   

      }

      var myLayer= myDocument.layers.add();

      myLayer.name="myFirstLayer";

      myLayer.visible=true;

      var masterspread = myDocument.masterSpreads.add(1);

      masterspread.baseName="NewMasterPage";

      masterspread.select(1919250519);

      var myTextFrame=masterspread.textFrames.add(myDocument.layers.item("myFirstLayer"));

      myTextFrame.geometricBounds = ["6p", "25p", "30p", "30p"];

      myTextFrame.contents = "Master Spread";

       

      I do no understand where is Syntax error.

       

      tell application "Adobe InDesign CS5.5"

                do script alias "HD:private:var:root:Documents:Adobe Scripts:Source1.jsx" language javascript

                          --> error "Syntax error" number 8

      Result:

      error "Adobe InDesign CS5.5 got an error: Syntax error" number 8


       


      Thanks.