Skip to main content
July 31, 2021
Frage

Add automatic "yyyymmdd" date into prefix field

  • July 31, 2021
  • 1 Antwort
  • 448 Ansichten

Hi,

 

I'm Wesley, designer from Guadeloupe. At work we have to do a lot of exports for the community management team and I want to know how (if possible) can I automatically add the date in the ISO 8601 format "yyyymmdd" in the prefix field.

 

I honestly have no clue how to do it. 

 

Thanks in advance for you time and I wish you all a great day.

 

Cheers,

 

Wesley.

Dieses Thema wurde für Antworten geschlossen.

1 Antwort

femkeblanco
Legend
July 31, 2021

Script-wise, you could have an export script which adds the date to the front of a document name in a file path.  (For this, the type of document to be exported and export options will be required).  For the date in the aforementioned format:

 

var d = new Date();
var m = d.getMonth() + 1, a = "", b = "";
if (String(d.getDate()).length == 1) {
    a = "0";
}
if (String(m).length == 1) {
    b = "0";
}
var ISO = d.getFullYear() + b + m + a + d.getDate();
alert( ISO );

 

August 1, 2021

Thanks a lot for your answer. Honestly I have no idea how this work but I'll figure it out ;).

 

femkeblanco
Legend
August 1, 2021

The above snippet gets the present date in the format you mentioned.  To be of use, it will have to be part of a larger script.  To see what the above snippet gets, copy and paste it in a jsx file (you can create a txt file and change the extension to jsx), then, while Illustrator is open, go to File > Scripts > Other Script (Ctrl+F12), find the file and open it.