Copy link to clipboard
Copied
I would like to get the date and time to append to the filename of a pdf file when it is saved.
Here is the function used for saving the file when a button is clicked:
mySaveAs = app.trustPropagatorFunction(function(doc,path)
{
app.beginPriv();
doc.saveAs(path);
app.endPriv();
})
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
{
// Privileged and/or non-privileged code above
app.beginPriv();
mySaveAs(doc,path);
app.endPriv();
// Privileged and/or non-privileged code below
});
Here is the code for the button (mouseup):
myTrustedSpecialTaskFunc(this, "/F/signedcontracts/signeddoc.pdf");
I would like to have the filename in the following format:
/F/signedcontracts/signeddocyyyymmddhhmmss.pdf
I have read through and tried several examples, but I'm still unable to get it to work properly.
Copy link to clipboard
Copied
I got it to work:
Function:
function myDateSTring(){
return util.printd("yyyymmdd_HHMMss", new Date());
}
mySaveAs = app.trustPropagatorFunction(function(doc,path)
{
app.beginPriv();
doc.saveAs(path);
app.endPriv();
})
myTrustedSpecialTaskFunc = app.trustedFunction(function(doc,path)
{
// Privileged and/or non-privileged code above
app.beginPriv();
mySaveAs(doc,path);
app.endPriv();
// Privileged and/or non-privileged code below
});
Button script:
myTrustedSpecialTaskFunc(this, "/F/signedcontracts/signed-doc-jlf"+myDateSTring()+".pdf");
Find more inspiration, events, and resources on the new Adobe Community
Explore Now