2 Replies Latest reply on Oct 15, 2014 1:20 AM by Jump_Over

    "Error Number 2" in Indesign CS3 script

    Collin de Visser

      Hello,,

       

      Everytime I run a script in  Indesign CS3 I get the following error:

       

      "Javascript error!

      Error Number: 2

      Error String: User cancelled this action.

      Line: 103

      Source: TF.place(aFile);"

       

       

      100oldRuler = myDoc.viewPreferences.rulerOrigin
      101myDoc.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;
      102var TF = addPageWithTF(masterPage);
      103TF.place(aFile);
      104var myPara = TF.paragraphs[0];

       

      Who can help me and see what's wrong?

      It's supposed to import a list of word-documents, but doesn't.

       

      Thanks in advance,

       

      Collin

        • 1. Re: "Error Number 2" in Indesign CS3 script
          csm_phil Level 4

          Hi Collin de Visser,

           

          Try the below codes.

           

          Please insert the below line after the 101 lines.

           

          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
          

           

          End of your code insert this line.

           

          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
          

           

           

          thx,

          csm_phil

          • 2. Re: "Error Number 2" in Indesign CS3 script
            Jump_Over Level 5

            Hi,

            ...

            Everytime I run a script in  Indesign CS3 I get the following error:

            ...

             

            So, can you run a script in other Indesign versions with no errors?

             

             

            ...

            102 var TF = addPageWithTF(masterPage);
            103 TF.place(aFile);
            ...

            Both lines use variables created outside of part of code you pasted here. Did you check their values (i.e. - debug breakpoint set and "DataViewer" opened in ESTK)

             

            What is the result of function addPageWithTF() - a page or a textFrame?

             

            Moreover:

            You can add a second parameter to method TF.place(file, showingOptions), like:

             

            TF.place(aFile, false);
            
            

             

            Jarek