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

Make Text Variables 1 Year In Advance (Expiry Date)

New Here ,
Jun 07, 2024 Jun 07, 2024

Copy link to clipboard

Copied

Hello. Does anyoe know a way to put the text variables 1 year in advance. So everyday I open indesign, the date has changed with a +1 year. 07-JUN-2025

TOPICS
Scripting

Views

225

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
Community Expert ,
Jun 07, 2024 Jun 07, 2024

Copy link to clipboard

Copied

Make a custom text variable called "oneyeardate". Then, run this script when you open the doc:

var d = new Date();
var day = ("0" + d.getDate()).slice(0,2);
var month = ("0" + d.getMonth() + 1).slice(0,2);
var nextyear = d.setFullYear(d.getFullYear() + 1);
app.activeDocument.textVariables.itemByName("oneyeardate").customTextVariablePreferences.contents = month + "-" + day + "-" + nextyear;

Votes

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
Community Expert ,
Jun 11, 2024 Jun 11, 2024

Copy link to clipboard

Copied

LATEST

For customTextVariablePreferences use variableOptions instead.

Votes

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