Scripting help to insert date in file name

New Here ,
Jun 09, 2021 Jun 09, 2021

Copy link to clipboard

Copied

Using InD 15.1.3, my client likes the date to be part of the file name and he likes it in a specific format: 06.09.21

 

Is there a way to program a shortcut key that will insert the current date in that format when naming/saving a file in InDesign?  I do this 100 times a day.

 

Thank you!

TOPICS
How to, Scripting

Views

118

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Adobe Community Professional , Jun 10, 2021 Jun 10, 2021
HI, Try following snippet to save the file that will append the date in the end. var dateObj = new Date(); var year = dateObj.getFullYear().toString().substr(-2); var month = ("0" + (dateObj.getMonth() + 1)).slice(-2); var date = ("0" + dateObj.getDate()).slice(-2); var _formattedDate = month + "." + date + "." + year; var fileName = "Test_" + _formattedDate + ".indd"; var file = app.activeDocument.save(File(Folder.desktop + "/" + fileName));

Likes

Translate

Translate
Adobe Community Professional ,
Jun 10, 2021 Jun 10, 2021

Copy link to clipboard

Copied

LATEST

HI,

Try following snippet to save the file that will append the date in the end.

var dateObj = new Date();
var year = dateObj.getFullYear().toString().substr(-2);
var month = ("0" + (dateObj.getMonth() + 1)).slice(-2);
var date = ("0" + dateObj.getDate()).slice(-2);
var _formattedDate = month + "." + date + "." + year;
var fileName = "Test_" + _formattedDate + ".indd";
var file = app.activeDocument.save(File(Folder.desktop + "/" + fileName));

 

Best regards

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines