Indesign Scripting: How can I move a placed item using Javascript?

10-11  Source: Network gathering  Views:4 

Advertisement
Hey all,
I have been trying to write a script that places a slug object from an indesign library on to a document and then moves it to my slug area. It all seems to work except the move command. I think the problem is that I haven't selected my placed asset correctly.
Please help!
This is what I have so far:
//Create new document
var doc = app.documents.add();
// Get page size values
var w = doc.documentPreferences.pageWidth;
var h = doc.documentPreferences.pageHeight;
//Create layer called SLUG
var slugLayer = doc.layers.add({name:"SLUG"});
//Set document slug area size
doc.documentPreferences.documentSlugUniformSize = false;
doc.documentPreferences.slugBottomOffset = "20 mm";
//Open InDesign library file that contains the slug file
var slugLibrary = app.open(File("/Users/Shared/Slug.indl"));
//Place slug script to go here
var myPlacedAsset = slugLibrary.assets.item("Slug");
var mySlug = myPlacedAsset.placeAsset(doc);
//Close the slug library
slugLibrary.close();
// Move slug object to slug area
mySlug.move([0,0]);
//Lock SLUG layer
slugLayer.locked = true;
placeAsset is an array so this line :  mySlug.move([0,0]);
should be changed to: mySlug[0].move([0,0]);
Related articles