11 Replies Latest reply: Oct 5, 2012 3:51 AM by Janneke S RSS

    Java Script in Acrobat

    Janneke S

      I am trying to make a popup Menu under a button in Acrobat X. For this I added a Javascript in the Button menu.

      I get the impression that there is a limit to the amount of lines Acrobat can manage because I get error messages that are not logical and when I delete a random line everything is ok.

      Is there anybody with experience in this matter?

        • 1. Re: Java Script in Acrobat
          try67 ACP/MVPs

          There is a limit to the amount of text you can enter to the internal script

          editor, but you would see a very clear indication when you reach that

          limit. It sounds like you have some other problem... What kind of error

          messages are you getting?

          • 2. Re: Java Script in Acrobat
            Janneke S Community Member

            It gives diverse SyntaxErrors. Missing spaces or other things in diffenet lines. There is really no logic in that. And when I reduce the ammount of lines, no matter what line I delete, it functions.

             

            I can give you the script on a point where it doesnot function anymore. The thing I added last was the second submenu. And thank you for reacting!

             

            var cChoice = app.popUpMenuEx

            (

                    {cName: "Tg. Winterberg",oSubMenu:

                    {cName: "De Jazzbarones",cReturn: "2"}

            },

                    {cName: "Maas",oSubMenu:

                    {cName: "Cash.",cReturn: "3"}

            },

                    {cName: "DOX - I Have a Dream",cReturn: "4"},

                    {cName: "BonteHond/Pompei - Dutch Vinex Wonder Boys",cReturn: "5"},

                    {cName: "BEER Muziektheater",oSubMenu:

                       [{cName: "Dali, of hoe word ik beroemd",cReturn: "6"},

                       {cName: "Ik ben niet bang",cReturn: "7"}]

            },

                    {cName: "BonteHond/NTjong - Zebra Zebra",cReturn: "8"},

                    {cName: "BonteHond - Harig Hondje",cReturn: "9"},

                    {cName: "De Toneelmakerij - KoudVuur!",cReturn: "10"},

                    {cName: "De Toneelmakerij/Firma Rieks Swarte - De Storm",cReturn: "11"},

                    {cName: "Esther de Koning/STIP",oSubMenu:

                    {cName: "H.O.T.-het begin",cReturn: "12"}

            },

                    {cName: "Het Houten Huis",oSubMenu:

                    [{cName: "Hotel Perdu",cReturn: "13"},

                    {cName: "Beet!",cReturn: "14"}]

            },

                    {cName: "Het Laagland",oSubMenu:

                    [{cName: "WIM IS WEG",cReturn: "15"},

                    {cName: "ROBIN HOOD",cReturn: "16"},

                    {cName: "KOFFERS OP REIS",cReturn: "17"}]

            },

                    {cName: "Hetpaarddatvliegt",oSubMenu:

                    [{cName: "Later als ik dood ben",cReturn: "18"},

                    {cName: "Rooi kop",cReturn: "19"}]

            }, 

                    {cName: "Maas",oSubMenu:

                    [{cName: "Alleen op de Wereld",cReturn: "20"},

                    {cName: "Wild Thing",cReturn: "21"},

                    {cName: "De Nieuwe Jetse",cReturn: "22"},

             

                    {cName: "Helaas Pindakaas",cReturn: "23"}]

            },

                    {cName: "Raaijmakers & Geerlings/STIP - Niet Huppelen!",cReturn: "24"},

                    {cName: "Theater Gnaffel",oSubMenu:

                    [{cName: "Apenstreken",cReturn: "25"},

                    {cName: "Peter Pan en de verloren jongens",cReturn: "26"}]

            },

                    {cName: "Theater Sonnevanck",oSubMenu:

                    [{cName: "Tijl Uilenspiegel",cReturn: "27"},

                    {cName: "Engel met vieze voeten",cReturn: "28"}]

            },

                    {cName: "Tg. Winterberg/STIP - Op een klein stationnetje",cReturn: "29"}

            );

            • 3. Re: Java Script in Acrobat
              try67 ACP/MVPs

              It works fine for me... Maybe you're not selecting the entire code when

              you're running it?

              • 4. Re: Java Script in Acrobat
                Janneke S Community Member

                I did select the entire code. So this is funny..

                It says SyntaxError: missing : after property id

                51: on line 52

                This is the last line with:    );

                • 5. Re: Java Script in Acrobat
                  try67 ACP/MVPs

                  Sorry, don't know what to tell you. The code you posted runs fine in

                  Acrobat 8 and X.

                  • 6. Re: Java Script in Acrobat
                    Janneke S Community Member

                    O.k. I tried to run it in another PDF file, but then it gave the same Error.

                    Then I tried in in Acrobat 9 and there it worked!

                    So somethig is wrong with (my?) Acrobat X.

                    Thank you for your support.

                    • 7. Re: Java Script in Acrobat
                      try67 ACP/MVPs

                      Have you updated to the very last version? Are you running it from the

                      console each time, or did you embed the script in the PDF?

                      • 8. Re: Java Script in Acrobat
                        Janneke S Community Member

                        Yes I updated the last version, but I'm not sure what you mean by running it from the console. I paste the script when making a button in Acrobat.

                        What I also noticed is that when I make the button in Acrobat 9 and then open the file in Acrobat X the Javascript functions. But I cannot make it directly in Acrobat X. The it gives these Errors when I make more lines.

                        • 9. Re: Java Script in Acrobat
                          Janneke S Community Member

                          I made some changes in the script in Acrobat 9 that are impossible in Acrobat X and it functions alright. So I think it must be a bug in Acrobat X...

                          I can open the script in Acobat X, but as soon as I change something it gives Errors.

                          • 10. Re: Java Script in Acrobat
                            try67 ACP/MVPs

                            It could be, although I've never heard of this bug before... You can report

                            it to Adobe here:

                            https://www.adobe.com/cfusion/mmform/index.cfm?name=wishform

                            • 11. Re: Java Script in Acrobat
                              Janneke S Community Member

                              Thank you, I'll do that.