5 Replies Latest reply on Feb 8, 2013 12:40 PM by jpkhor

    Acrobat X Pro Freezes when editng JavaScripts

    jpkhor

      My Acrobat X Pro freezes a lot when I edit javascripts.  I have version 10.1.5 running on Windows 7 Pro, 64-bit OS.  Every time I force exit and restart the app, and my changes on code will not save.  Any idea what's going on?  How do I avoid it or it is simply a bug?

       

      Thank you

       

      JP

        • 1. Re: Acrobat X Pro Freezes when editng JavaScripts
          gkaiseril MVP & Adobe Community Professional

          Are you using the default Adobe supplied text editor?

           

          Are the scripts large?

           

          Do you have a circular reference? This will put the calculation into an infinite loop.

           

          Are you writing a lot of data to the Acrobat JS console?

           

          To debug, I would comment out all JavaScripts.

           

          Open the JavaScript console and look for any errors.

           

          Check all your non-custom JavaScript calculations for errors.

           

          Uncomment each JavaScript action one at time.

          1 person found this helpful
          • 2. Re: Acrobat X Pro Freezes when editng JavaScripts
            jpkhor Level 1

            Not using JS console, only at editing JavaScripts to an Action on Text Field Properties.  The script is simple, just checking if the text field's value is not empty and not equal the default value, then save to a new filename.  No circular reference or writing to console...

             

            if ((this.getField("FieldName").value=="FieldName") || (this.getField("FieldName").value==""))

            {

            app.alert({cMsg:"Field name is required"});

            this.getField("FieldName").setFocus();

            }

            else

            {

            var FName = this.getField("FieldName").value;

            var oMyDoc = "C:\Filename-" + FName + ".pdf";

            app.execMenuItem("SaveAs");

            app.openDoc(oMyDoc);

            this.resetForm();

            this.closeDoc(true);

            }

             

            Thank you.

            • 3. Re: Acrobat X Pro Freezes when editng JavaScripts
              try67 MVP & Adobe Community Professional

              Couple of problems there:

              - Your file path syntax is not correct and the use of "\f" can cause some problems because it is interpreted as an escaped character.

              - You can't use openDoc in this manner. It has to be executed from a trusted context.

              - Your use of the "this" object after opening the file is also problematic. You need to use the Doc object returned by the openDoc method.

              1 person found this helpful
              • 4. Re: Acrobat X Pro Freezes when editng JavaScripts
                gkaiseril MVP & Adobe Community Professional

                The JavaScript console will display errors and with some simple coding also show you what is going on with a problem script.

                 

                The Acrobat JavaScript Console (Your best friend for developing Acrobat JavaScript)

                 

                It will also let you see the folder level and document level scripts, observe variables and set break points so you can pause a running script without shutting down Acrobat.

                1 person found this helpful
                • 5. Re: Acrobat X Pro Freezes when editng JavaScripts
                  jpkhor Level 1

                  I think the errors on my javascripts have caused the freezing.  I have managed to get the result I want without the app freezing again.

                  Thanks everyone for your tips.