2 Replies Latest reply on Jun 13, 2013 3:29 PM by Akyron

    add code to generate filename to existing "Save As" button

    tmg72

      Hi. I created a pdf version of a standard form we use here at the office. One of the users is very, very much a computer novice and simply saving and renaming is a challenge. So, I put a shortcut to the form in the folder where the created forms need to be saved (so that is the default save location) and created a save as button on the form, but I'd also like to automate the save as file name.

       

      I have this code under the "mouseup" event:

       

      app.execMenuItem("SaveAs")

       

      var fn =   getField("date").rawValue  + "-" + getField("company").rawValue;

       

       

      This is my result...

      _3c5o2408p3b4a69j3o.pdf

       

      Any ideas what I'm doing wrong or missing OR what might be a better way to skin this cat?

       

      Thanks!

        • 1. Re: add code to generate filename to existing "Save As" button
          Mandy_Wiesener Level 3

          I use always:

          var FilePath = event.target.path;
          this.rawValue = FilePath;
          

           

          Important:

          If you use this in the preview of the LCD you get your result.

          The right result (the path) you get if you use this with the Adobe Reader.

           

          This is the same with this script then with the LCD preview you got the temp file name:

          this.rawValue = event.target.documentFileName;
          

           

          Hope it will helps you,

          Mandy

          • 2. Re: add code to generate filename to existing "Save As" button
            Akyron Level 1

            Did you get this figured out?

             

            I have a related issue where I want to save the form file with a save button to a specific path and also name it according to the value of several variables in the filled out form.

             

            i.e "Code_serial_workorder_date.pdf"

             

            If I could email that file with the same button that would be even better.

             

            I have been looking around the forums but I have yet to see something like that.

             

            DT