We do what we call Auto Fills. They are pdf docs that populate some fields from dat files a Marco has created on the user’s hard drives. When the pdf doc is accessed its Javascript uses these dat files to get the needed data, (see script below).
this.getField("IV5").value = (d.getMonth()+1).toString()+"/"+d.getDate().toString()+"/"+d.getFullYear();
DataPath = "C:\\ueid.dat";
importTextData(DataPath,0);
var Ueid = this.getField("ueid");
var Ueidv = Ueid.value;
DataPath = "D:\\users\\"+Ueidv+"\\DBU data\\fd792.dat";
importTextData(DataPath,0);
DataPath = "C:\\Documents and Settings\\"+Ueidv+"\\SBU\\ename.dat";
importTextData(DataPath,0);
DataPath = "C:\\Documents and Settings\\"+Ueidv+"\\SBU\\epnum.dat";
importTextData(DataPath,0);
All of this works fine but I would like to also delete the fd792.dat file just after using it. Unfortunately I can not find any code that works to do this file delete. Can this be done and if so can you post the code needed?
Deleting a file from the user's hard drive is right off the map. As useful as this could be (and I've wished for it quite often), you will never be able to do it. In fact, your code is going to break in Acrobat 8 because they've added more restrictions for accessing outside data. Take a look at the latest JS Ref.
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script