Indesign Script for multiple pages
hello,
i working on file utilizes data merge retrieve data csv file. works perfect. data text , color update other fields in file. problem have works on first page. how script file perform action on each page , take page specific info , make updates on page. below code.
main();
function main()
{
var mystyleout, mysizeout, myticketout, mylt_sloganout, myrt_sloganout, mylt_slogancolout, myrt_slogancolout, mylt_tongcolout, myrt_tongcolout;
var mytext ;
mystyleout=mytextcontent("txtstyle");
mysizeout=mytextcontent("txtsize");
myticketout=mytextcontent("txtstyle");
mylt_sloganout=mytextcontent("txtleft_slogan");
myrt_sloganout=mytextcontent("txtright_slogan");
mylt_slogancolout=mytextcontent("txtleft_slogan_col");
myrt_slogancolout=mytextcontent("txtright_slogan_col");
mylt_tongcolout=mytextcontent("txtleft_tong_col");
myrt_tongcolout=mytextcontent("txtright_tong_col");
$.write(mystyleout.contents +"\u000d");
$.write(mysizeout.contents +"\u000d");
$.write(myticketout.contents +"\u000d");
$.write(mylt_sloganout.contents +"\u000d");
$.write(myrt_sloganout.contents +"\u000d");
$.write(mylt_slogancolout.contents +"\u000d");
$.write(myrt_slogancolout.contents +"\u000d");
$.write(mylt_tongcolout.contents +"\u000d");
$.write(myrt_tongcolout.contents +"\u000d");
//left tongue slogan
myobj = app.activewindow.activespread.pageitems.itembyname("frmleft_tongue");
myobj.fillcolor=mylt_tongcolout.contents;
mytextframe = app.activedocument.textframes.itembyname("txtlefttong");
mytextframe.contents = mylt_sloganout.contents;
mytext = mytextframe.parentstory.paragraphs.item(0)
mytext.fillcolor = mylt_slogancolout.contents;
//right tongue slogan
myobj = app.activewindow.activespread.pageitems.itembyname("frmright_tongue");
myobj.fillcolor=myrt_tongcolout.contents;
mytextframe = app.activedocument.textframes.itembyname("txtrighttong");
mytextframe.contents = myrt_sloganout.contents;
mytext = mytextframe.parentstory.paragraphs.item(0)
mytext.fillcolor = myrt_slogancolout.contents;
}
function mytextcontent(mytext1)
{
var mytextout = app.activedocument.textframes.itembyname(mytext1);
return mytextout;
}
thanks...
hi indeed referencing items located on current spread when :
myobj = app.activewindow.activespread.pageitems.itembyname("frmleft_tongue");
you should able extend call using
var items = app.activedocument.allpageitems; var n = items.length; while (n--) { if ( items[n].name == "some name" ) { //do item } }
hth
loic
More discussions in InDesign Scripting
adobe
Comments
Post a Comment