I am using a Folder-Level Javascript to manipulate the save path and file name and it works perfectly. My problem is...when I click my button, the original form closes and the new "renamed" file comes up in place of the original. The behavior I want, is for the original document to stay open and the renamed file to be saved silently. How do I accomplish this?
Here is the code that I pieced together from other posts:
Folder Level Script:
//DateTime function
function myDateString()
{
return util.printd("mmddyy_HHMMss", new Date());
}
// SaveAs Function
var mySaveDoc = app.trustedFunction(function(doc) {
app.beginPriv();
var myPath = "/c/Forms" + "/" + "Special Study Form" + "-" + myDateString() + ".pdf";
doc.saveAs(myPath);
app.endPriv();
});
On the MouseUp I have
event.target.mySaveDoc(event.target);
Any help would be greatly appreciated.
What you want to do is save a copy. Look up the Doc.saveAs() function in the Acrobat JavaScript Reference. It has an argument named "bCopy".
doc.saveAs({cPath:myPath, bCopy:true});
Thom Parker
The source for PDF Scripting Info
www.pdfscripting.com
Very Important - How to Debug Your Script