How to place an asset from the library to all pages via JavaScript?
hello, i'm newbie in scripting that's why need 1 knows. need javascript place asset library pages of document.
i've tried have :
var mylibpath = (file("c:/library.indl"));
var mylib = app.open(mylibpath);
var libitem = app.libraries[0].assets[0].placeasset(app.documents[0]);
this places asset selected page only, may can tell me how can works pages.
thanks!
hi egikas,
try below code
var mydoc = app.activedocument;
var mypages = mydoc.pages;
var libraryfilepath=new file("c:\\library.indl");
app.open(file(libraryfilepath));
myasset = app.libraries[0].assets.item("test");// change name ase per ur requirement
for (var pg =0; mypages.length>pg; pg++)
{
var myobj = myasset.placeasset(app.documents.item(0))[0]; //first place library in first page
myobj.move (mypages[pg]);
myobj.move ( [15, 15] );//change ur x.y coodinate per ur requirement
}
mi_d
More discussions in InDesign Scripting
adobe
Comments
Post a Comment