11 Replies Latest reply on Aug 29, 2012 7:18 PM by George_Johnson

    Dynamic Stamp Problem with promoting script

    kainetarlo

      Hi I wondering if someone could help with java script for acrobat pro X to produce a dynamic stamp. I want to be promted for a "Date" (as not always current date) and an "Application number". I copied a script from a previous poster, Benoit Verreault (- thank you!)

       

      First Text Field:

      var cAsk = "Enter Date (YYYY-MM-DD)"; var cMsg=app.response(cAsk); event.value=cMsg;

       

      Second Text Field:

      var cAsk = "Enter Application Number"; var cMsg=app.response(cAsk); event.value=cMsg;

       

      The stamp works. However, I am having the same problem as Benoit. I.e. the first time I enter a document and invoke the stamp menu, the minute my mouse hover over the stamp category under which my stamp is stored, I instantly get prompted for all four parameters but nothing else happen. After this nuisance event, I can invoke the stamp normally. I can drop the stamp where I want it and then I get prompted to fill in the requested info. Upon the last entry, the stamp appears with the supplied info. Is there additional JS code I need to add to my Custom Calculation Script in order to avoid this nuisance prompting??

       

      Many thanks, I have tried many of the tutorials and spend hours trying to develop this stamp!

      Kaine

        • 1. Re: Dynamic Stamp Problem with promoting script
          George_Johnson MVP & Adobe Community Professional

          This tutorial includes the information you need: http://acrobatusers.com/tutorials/print/dynamic_stamp_secrets

           

          Better yet, if you will be developing many stamps in the future, get the book: http://www.amazon.com/About-Stamps/dp/0985614706

          • 2. Re: Dynamic Stamp Problem with promoting script
            kainetarlo Level 1

            Thanks George, but I have read that tutorial, and many others. I am far from a cumputer guru and am struggling to get my ahead the scripting part. Could you possibly just give me the scrips for the two tasks, as above? I just want to be promoted for a date and application number.

            • 3. Re: Dynamic Stamp Problem with promoting script
              George_Johnson MVP & Adobe Community Professional

              As explained in the tutorial, you need to include code like the following when using the app.repsonse method to prompt the user for input:

               

              if (event.source.forReal && (event.source.stampName == "#UdzyXagRctZoS5p43TZ43C")){

                   event.value = app.response();

              }

               

              You will need to adjust the stampName to match the stamp template you're using. So, your code would look more like:

               

              // Calculate script

              if (event.source.forReal && event.source.stampName == "#UdzyXagRctZoS5p43TZ43C") {

                  var cAsk = "Enter Date (YYYY-MM-DD)";

                  var cMsg = app.response(cAsk);

                  event.value = cMsg;

              }

               

               

              Again, you'll have to find out the stamp name of the template in question and use it in the code above. The tutorial mentions how to do this.

               

               

              Edit: Correct a typo

              • 4. Re: Dynamic Stamp Problem with promoting script
                kainetarlo Level 1

                Hi Geroge,

                 

                I have located my stamp name (lxkFy0hWPMsGI_s8_nCcQD) and have imputed your script. Did you mean that I simply just place the following script into the custom calculation script fields? Also, are the scripts below meant to be two seperate scripts which are to be entered into 2 seperate fields, so that I will be promoted for date and application number?

                 

                I gave this a go but I get a message "syntax error; missing ; before statement 3: at line 4". Thanks for your asisstance and sorry for my ignorance.

                 

                 

                 

                if( event.source.forReal && (event.source.stampName == "#lxkFy0hWPMsGI_s8_nCcQD")){

                     event.value = app.response();

                }

                 

                // Calculate script

                if (event.source.forReal && (event.source.stampName == "#lxkFy0hWPMsGI_s8_nCcQD")) {

                var cAsk = "Enter Date (YYYY-MM-DD");

                var cMsg = app.response(cAsk);

                event.value = cMsg;

                }

                • 5. Re: Dynamic Stamp Problem with promoting script
                  George_Johnson MVP & Adobe Community Professional

                  I corrected a typo soon after posting that code. It should be:

                   

                  // Calculate script

                  if (event.source.forReal && (event.source.stampName == "#lxkFy0hWPMsGI_s8_nCcQD")) {

                  var cAsk = "Enter Date (YYYY-MM-DD)";

                  var cMsg = app.response(cAsk);

                  event.value = cMsg;

                  }

                   

                  This script is for the data field. It will be much the same for the other field, but with a different prompt text. You can enter them as two separate scripts, but it is usually a good idea to use just a single script in one of the fields, but you'd have to change the code to something like:

                   

                  // Calculate script for date field

                  if (event.source.forReal && (event.source.stampName == "#lxkFy0hWPMsGI_s8_nCcQD")) {

                   

                  var cAsk = "Enter Date (YYYY-MM-DD)";

                  var cMsg = app.response(cAsk);

                  event.value = cMsg;

                   

                  cAsk = "Enter Applicatio Number";

                  cMsg = app.response(cAsk);

                  getField("Text2").value = cMsg;

                   

                  }

                   

                   

                  Replace "Text2" with the actual name of the other text field.

                  • 6. Re: Dynamic Stamp Problem with promoting script
                    kainetarlo Level 1

                    Thanks George.

                     

                    You obvoiusly know your way around acrobat, but unfortunetly I still cannot get it to work.

                     

                    When I enter the script in the the custom calculation script field it does not do anything when I use the stamp. I am really unsure of what I am doing wrong. Could you possibly email me so that I can email you back a screen shot to see if you can notice something I am doing wrong.

                     

                    Many thanks for all you assistance, I cannot believe how difficult this seems to be.

                     

                    Kaine

                     

                    kainetarlinton@hotmail.com

                    • 7. Re: Dynamic Stamp Problem with promoting script
                      Test Screen Name Most Valuable Participant

                      You can post screen shots right here in the forum.

                      • 8. Re: Dynamic Stamp Problem with promoting script
                        gkaiseril MVP & Adobe Community Professional

                        I have found you have to create and add the stamp you are creating using the Acrobat and the Manage Stamps process. Then you can open the stamp in the location Acrobat has placed the stamp and add and edit the fields. After you have done that, you will need to restart Acrobat/Reader for the changed stamp to become activated.

                        • 9. Re: Dynamic Stamp Problem with promoting script
                          George_Johnson MVP & Adobe Community Professional

                          It's not really that difficult, but it won't work if you do not get the stamp name exactly right.

                          • 10. Re: Dynamic Stamp Problem with promoting script
                            kainetarlo Level 1

                            Hi George,

                             

                            When I try to insert the image of the screen shot into this post the following msg appears. [The content type of this image is not allowed.]

                             

                             

                             

                            I can create and edit and stamp okay. As per my original post, I can get the stamp to do exactly what I want however using the old script, but I constantly get promoted to enter in the application no and date. So there is obvouisly an error. 

                             

                            The script you have given me does not prompt me at all. I was wondering if you could kindly email me your address so I can show you the screen shot to see if there is something I am doing incorrectly.

                             

                            The name of my stamp is lxkFy0hWPMsGI_s8_nCcQD.pdf

                             

                            Thanks, Kaine

                             

                             

                             

                             

                             


                            • 11. Re: Dynamic Stamp Problem with promoting script
                              George_Johnson MVP & Adobe Community Professional

                              That's the file name of the stamp file, not the not the name of the stamp (aka Appearnace name) within the stamp file, which is included in the template name of the page within the stamp file that's used as the stamp source. If this doens't help, feel free to send me the stamp file and I'll fix it for you: acroscript at gmail dot com