Quantcast
Channel: Adobe Community: Message List - InDesign Scripting
Viewing all articles
Browse latest Browse all 37788

Re: How to get a date on different pages?

$
0
0

Try this,

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.pageOrigin;

app.activeDocument.zeroPoint = [0,0];

with(app.activeDocument.viewPreferences){

    horizontalMeasurementUnits=MeasurementUnits.points;

    verticalMeasurementUnits=MeasurementUnits.points;

    rulerOrigin=RulerOrigin.pageOrigin;

    }

 

var months = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" ];

var length = [ 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 ];

var days = [ "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" ];

count = 0;

day = 0;

month = 0;

weekday = 5;

str = [];

 

 

while (count < 365)

{

count++;

str[count]= days[weekday]+", "+(day+1)+" "+months[month]+"\r";

str1 =str.toString();

day++;

if (day >= length[month])

{

  day = 0;

  month++;

  if (month > 11)

   month = 0;

}

weekday = (weekday+1) % 7;

}

 

 

for(i=0;i<document.pages.length;i++)

{

var myTextframe = document.pages[i].textFrames.add({geometricBounds:[0,0,50,150]});

myTextframe.insertionPoints[0].contents=str[i+1];

}

 

 

 

Vandy


Viewing all articles
Browse latest Browse all 37788

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>