Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Text Variables for Dates

New Here ,
Dec 02, 2022 Dec 02, 2022

Is there a way to create a folio to automatically display the next day's date? I know how to create one to display the date using the modifaction date, but is it even possible in InDeign to have a folio be based on the intended publication date? I produce a newspaper the night before publication date and using a text variable to display the next day's date would be ideal. 

TOPICS
How to , Import and export , Print
355
Translate
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
Community Expert ,
Dec 02, 2022 Dec 02, 2022

Only thing I can suggest is setting your system clock date one day ahead. You might be able to script that.

Translate
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
Advisor ,
Dec 02, 2022 Dec 02, 2022
LATEST

Hello @tonyb13686604,

 

You can give this script a try for your needs...it creates a Custom Text type Text Variable named "Publication Date" that will disply tomorrows date.

 

EDIT: the code was modified on 12-03-22 @6:00pm EST

 

addDays(1);
function addDays(addDay){
    var today = new Date();
    today.setDate(today.getDate() + addDay); 
    var month = "0" + (today.getMonth()+1);
    var date = "0" + today.getDate();
    month = month.slice(-2);
    tomorrowsDate = date.slice(-2);
     var tomorrowsDate = month + "-" + date + "-" + today.getFullYear();

try{app.activeDocument.textVariables.add({name:"Publication Date", variableType:VariableTypes.CUSTOM_TEXT_TYPE,}); } catch (e){}
   if(app.activeDocument.textVariables.itemByName("Publication Date").isValid){
     app.activeDocument.textVariables.itemByName("Publication Date").variableOptions.contents = tomorrowsDate;
  }
}

 

Regards,

Mike

Translate
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