I'm trying to determine if a specific .xml file exists on my desktop before running additional code. The following trusted script is in my Javascripts folder-level directory. The section commented as "First Part" below simply sets all fields of the form to be open/writable. The second part looks for a .xml file in which to import XFA data from.
My problem is that I'm trying to determine whether this .xml file exists in the first place. Right now if it doesn't exist, it displays a dialog window to browse for the file. Instead I'd like it to show an alert if the xml file does not exist, and never show the dialog at all. What am I doing wrong?
Any help is huge, thanks
CODE:
var myTrustFunctTwo = app.trustedFunction(function(doc)
{
//First Part
for (var nPageCount = 0; nPageCount < doc.numPages; nPageCount++) {
var oFields = doc.xfa.layout.pageContent(nPageCount, "field");
//app.alert(oFields,0);
var nNodesLength = oFields.length;
// Set the field property.
for (var nNodeCount = 0; nNodeCount < nNodesLength; nNodeCount++) {
oFields.item(nNodeCount).access = "open";
}
}
//Second Part
app.beginPriv();
doc.importXFAData({
cPath:"/c/Users/ME/Desktop/Filled_In.xml"
});
app.endPriv();
});
app.trustedFunction(myTrustFunctTwo);
0 comments:
Post a Comment