execDialog function externally from Folder level script
HI Forum..
Happy New New.
I Need a support from you. I'm using the Folder Level script which is loaded in Acrobat/Javascript folder and while running the script I wanted to call the app.exec Dialog functions code saved at external servers. I have tried this by importDataObject method to load the execDialog script into PDF as an attachment and then reading the codes using getObjectData method.
// Loaded the below script in Acrobat/javascript folder....
var rajniTrust = app.trustedFunction(function()
{
app.beginPriv();
var oFile = util.readFileIntoStream("/Users/rnarayanan/Desktop/ABERDEEN_Checklist.js");
//var c = util.stringFromStream(oFile);
this.importDataObject("oFile", "/Users/rnarayanan/Desktop/ABERDEEN_Checklist.js");
var oFile = this.getDataObjectContents("oFile");
var cFile = util.stringFromStream(oFile, "utf-8");
AFExecuteThisScript(cFile); // THIS IS NOT EXECUTING THE Script.......
app.endPriv();
}
var DoCmdImportNamedAttach =
"// Enter your JavaScript code here\n" +
"// Or select one or more JavaScrippets\n" +
"rajniTrust()";
//</JSCodeSnippet>
//<JSCodeSnippet name="ButtonObjDef">
var oButObjImportNamedAttach =
{cName: "ImportNamedAttach",
cExec: DoCmdImportNamedAttach,
cEnable: "event.rc = (app.doc != null)",
cMarked: "event.rc = false",
cTooltext: "Rajni_Automation",
nPos: -1};
//</JSCodeSnippet>
if(oIconImportNamedAttach != null)
oButObjImportNamedAttach.oIcon = oIconImportNamedAttach;
try{app.removeToolButton("ImportNamedAttach");}catch(e){}
//<JSCodeSnippet name="TryAddBut">
try
{
//</JSCodeSnippet>
//<JSCodeSnippet name="AddButtonfn">
app.addToolButton(oButObjImportNamedAttach);
//</JSCodeSnippet>
if((event.type == "Doc") && (app.viewerVersion >= 7))
global["ImportNamedAttach_InDoc"] = "3:28:2009:9:48:55";
else
global["ImportNamedAttach"] = "3:28:2009:9:48:55";
//<JSCodeSnippet name="CatchAddBut">
}catch(e)
{
if((global.bReportNameCollision != null) && (global.bReportNameCollision == true))
{
var strError = 'Cannot Install AcroButton "oButObjImportNamedAttach"\n';
strError += ':' + e.fileName + '\n';
strError += 'Error: ' + e.name + '\n';
strError += e.message + '\n';
strError += 'Possible Name conflict';
app.alert(strError,0,0,'AcroButton Error');
}
}
Thanks for the help.
