2 Replies Latest reply on Aug 24, 2014 9:38 AM by tdjohnson7700

    Import text into a form from a tab delimited file using an action

    tdjohnson7700

      Good evening.

      I am using Adobe Acrobat XI Pro

       

      I have been working all weekend so far on this, and have tried many options.

       

      What I am wanting is to import a line of data from an excel file into a form, save the file with a name drived from the form fields, close the new file, then go back to the original file, import a line of data, and so on and so on.

       

      I had all of this working in livecyle with a tool, but now that we are going to Windows 8 and Microsoft Office 2013, the driver that I need to load the excel file into the form is not available--so now I have to redo the forms in Adobe and import using a tab delimited file.

       

      I would like to do this with an action.

       

      Thus far, I have the following.


      **Credit goes to George Johnson who helped me with the script to save the file using field names a few months ago**


      To start, I have a folder level script

       

      mySaveAs = app.trustPropagatorFunction(function(doc,path)

      {

      app.beginPriv();

      var myDoc = event.target;

      myDoc.saveAs(path);

      app.endPriv();

      })

      myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)

      {

      //privileged and/or non-privileged code above

      app.beginPriv();

      mySaveAs(doc, path);

      app.endPriv

      //Privileged and/or non-privileged code below

      });

       

      For the Action, I start with the Form file loaded

       

      Then I execute a javascript to import the text into the file.

       

      this.importTextData("/c/data/clerical.txt");

       

      The next step is to save the file using field names as part of the file name

      --credit goes to George Johnson who assisted me with this on a similar project a few months ago.

       

      //Get the Field Value

      var fn=getField("Last").valueAsString + "-" + getField("First").valueAsString;

       

      //Specify the folder

      var fldr = "/c/data/";

       

      //Determine the full path

      var fp=fldr + fn + ".pdf";

       

      //save the file

      myTrustedSpecialTaskFunc(this, fp);

       

      That is as far as I have gotten. 

       

      What I want to do now is load the original form file, import the next line into the form, save the file, repeat.

       

      If anyone could assist me, I would greatly appreciate it.

      **note  I had to type this from my I-pad because I kept getting kicked off the internet from my computer.  I hope my code is typed correctly.