Skip to main content
Participating Frequently
February 29, 2016
質問

How to add the current date and time to the filename when saving the file in Adobe Pro XI?

  • February 29, 2016
  • 返信数 1.
  • 581 ビュー

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.

このトピックへの返信は締め切られました。

返信数 1

gmailJerald作成者
Participating Frequently
March 1, 2016

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");