These forums are now Read Only. If you have an Acrobat question, ask questions and get help from one of our experts.

Adobe 8 Ignoring Folder Level Script

LMPIPER
Registered: Apr 4 2007
Posts: 16

We do what we call Auto Fills. They are pdfs that self populate some data from dat files stored on the user’s hard disk. My users have adobe versions 5 thru 7. Some of them are about to get 8. The current JavaScript code will not work at 8. I have updated the code, (see below) adding an Adobe 8 section. The new code uses a Folder level script, (Importdata.js). The new code works fine for Adobe versions 5 thru 8 as long as the pdf doc is accessed from the user’s hard drive or a shared drive.

The problem is that our users access these pdfs from an intranet web page, and they do not work with adobe 8. If I copy a web pdf to my desktop it auto fills just as it should. It is acting like it is not able to access the folder level script. I have placed this script in both the local and global locations.

What am I missing?

Folder Level Importdata.js

TrustedImportTextData = app.trustedFunction( function ( oDoc, z, w )
{
app.beginPriv();
var myReturn = oDoc.importTextData(z,w)
app.endPriv();
return myReturn;
});

Document Level Script

/*********** belongs to: Document-Level:SelectVersion ***********/
function SelectVersion()
{
if (typeof app.formsVersion != "undefined" && app.formsVersion >= 8)
importData()

else

StartMe()
}

//
//

//
//StartMe
//
/*********** belongs to: Document-Level:StartMe ***********/
function StartMe()
{
DataPath = "C:\\seid.dat";
importTextData(DataPath,0);
var Seid = this.getField("seid");
var Seidv = Seid.value;
DataPath = "D:\\users\\"+Seidv+"\\SBU data\\Form9856.dat";
importTextData(DataPath,0);

var DataPath ;

DataPath = "C:\\Documents and Settings\\"+Seidv+"\\SBU\\Stop.dat";
importTextData(DataPath, 0);
DataPath = "C:\\Documents and Settings\\"+Seidv+"\\SBU\\IDRSnumber.dat";
importTextData(DataPath, 0);
var d = new Date();
this.getField("date").value = (d.getMonth()+1).toString()+"/"+d.getDate().toString()+"/"+d.getFullYear();
}
//
//

//
//importData
//
/*********** belongs to: Document-Level:importData ***********/
function importData()
{
TrustedImportTextData(this,"/c/seid.dat",0);
var Seid = this.getField("seid");
var Seidv = Seid.value;
TrustedImportTextData(this,"D:/users/"+Seidv+"/SBU data/Form9856.dat",0);
TrustedImportTextData(this,"C:/Documents and Settings/"+Seidv+"/SBU/Stop.dat",0);
TrustedImportTextData(this,"C:/Documents and Settings/"+Seidv+"/SBU/IDRSnumber.dat",0);
var d = new Date();
this.getField("date").value = (d.getMonth()+1).toString()+"/"+d.getDate().toString()+"/"+d.getFullYear();

}
//
//

//
//Page1:Page Open:Action2
//
/*********** belongs to: Page-Actions:Page1:Page Open:Action2 ***********/

SelectVersion();

//
//

Thanks for your help.

Leo

My Product Information:
Acrobat Pro 8.1.2, Windows
thomp
Expert
Registered: Feb 15 2006
Posts: 4411
Were there any errors reported in the JavaScript Console?

When you say that the form was accessed from the Web, do you mean that the PDF was displayed in the browser?

If you force the PDF to not be displayed in the browser what happens? In the Acrobat Preferences, open the "Internet" panel and unselect "Display PDF in browser".

Acrobat 8 has more security features than earlier versions and importing data from a local file is a potential security hazard. Also, Acrobat has always acted differently when it is displayed in an external window. It's very likely that Acrobat just bumped up the restrictions on this kind of usage.

Thom Parker
The source for PDF Scripting Info
[url=http://www.pdfScripting.com]pdfscripting.com[/url]

The Acrobat JavaScript Reference, Use it Early and Often
[url=http://www.adobe.com/devnet/acrobat/]http://www.adobe.com/devnet/acrobat/[/url]

Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script

LMPIPER
Registered: Apr 4 2007
Posts: 16
Thanks for your reply.

There are no errors reported in the JavaScript Console.

The PDF was displayed in the browser.

When I set the Preferences to unselect “Display PDF in browser”, the file worked correctly, (it auto filled as it should). On closing it asked if I wanted to save the doc as the doc name with a (1) at the end. In this case I said yes and it then closed. I then searched for the doc and could not find it. When I chose “save as”, it was saved in the “My Documents” folder. I don’t know where the 1st doc went.

The user’s normal procedure is to print the completed document and then close the PDF. The browser does not ask you if you want to save, (this is a good thing for our needs).

I will be looking at the manuals you recommended.

Thanks again for your help. Please let me know if you have any other ideas.

Leo