How to get a date on different pages?
hey everyone, working on daily planner office , have script automatically generates dates don´t know how each of dates on different page. i'd appreciate if me each date generated script on teh following page of 365 page document. scrip is:
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 += days[weekday]+", "+(day+1)+" "+months[month]+"\r";
day++;
if (day >= length[month])
{
day = 0;
month++;
if (month > 11)
month = 0;
}
weekday = (weekday+1) % 7;
}
app.selection[0].contents = str;
tanks!
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
More discussions in InDesign Scripting
adobe
Comments
Post a Comment