filepath for a .txt file attached to a pdf form
Hello, all,
I have a pdf form which contains fields for all my clients' contact details (Name, Address, Telephone, Email, Website, Instagram etc). Thanks to a LOT of help from this forum, I have set it up so that all of these fields are populated when I select the company name from a dropdown list. The data is stored in a tab-delimited file at a fixed, specified location on my hard drive. (oh, I'm on Acrobat DC).
What I'd REALLY like to be able to do, is attach the .txt file to the pdf itself, so that it doesn't matter where I move it to, it will carry its own datasheet around with it.
The script I use currently to get the data from the txt file is:
var Trusted_readContactDetails = app.trustedFunction(readContactDetails);
function readContactDetails()
{
app.beginPriv();
var oFile = util.readFileIntoStream("/Macintosh HD/Users/somefoldernames/morefolders/InvoiceContacts.txt");
var cFile = util.stringFromStream(oFile, "utf-8");
var yourCode = cFile.split("\n");
var i;
var aListEntries = [], cVal;
for (i = 0; i < yourCode.length; i++){
var tempArray = yourCode.split('\t');
cVal = tempArray.shift();
aListEntries.push([cVal,tempArray.join(";")]);
}
this.getField("SelectCompany").setItems(aListEntries);
app.endPriv();
}
What I'd like to know is what path do I need to specify to reference the .txt file if it is attched to the parent pdf?
Any help gratefully recieved, and thanks in advance for your time.
Nathan
