Instead of hardcoding the filepath to save the pdf to, I'm trying to setup the code that saves to a temporary location. So that it would goto any user saving the form to a temp directory.
Example: %tmp% = c:\DOCUME~1\any_user\LOCALS~1\Temp?
Currenty trusted function:
var mySaveAs = app.trustedFunction(
function(oDoc,cPath,cFlName)
{
app.beginPriv();
// Ensure path has trailing "/"
cPath = cPath.replace(/([^\/])$/, "$1/");
try{
oDoc.saveAs(cPath + cFlName);
}catch(e){
app.alert("Error During Save");
}
app.endPriv();
});
Currently using this script in a button
// mouse up action script to call the trusted mySaveAs function
// First make sure the function exists
if(typeof(mySaveAs) == "function") {
var sPath = this.path; // get path including file name and type
var aPath = sPath.split('/'); // make array to remove the file name and type
aPath[aPath.length - 1] = ''; // remove the file name and extension
sPath = aPath.join('/'); // rebuild path without file name and extension
// save this doc, in sPath, with the name of 'MyNewPDF.pdf'
mySaveAs(this, "/%tmp%/", + "In Progress" + "-" + "TEMP" + ".pdf");
} else {
app.alert("Missing Save Function\n" +
"Please contact forms administrator");
}
// end button mouse up action
Getting error during save.
You need to specify the actual path.
Also, it will be helpful if you say which exact error message you're getting since it contains a lot of useful like the type of error and the line where the error occurred.
- AcrobatUsers Community Expert - Contact me personally at try6767 [at] gmail [dot] com
Check out my custom-made scripts website: http://try67.blogspot.com