Scripting inDesign: How can I move an element placed using Javascript?

Hey all,.

I tried to write a script that puts an object slug from an indesign library to a document and then put in my area of slug. Everything seems to work except the command move. I think the problem is that I did not choose my asset placed correctly.

Help, please!

That's what I have so far:

Create new document

var doc = app.documents.add ();

Get the values of page size

var l = doc.documentPreferences.pageWidth;

var h = doc.documentPreferences.pageHeight;

Create the layer called SLUG

var slugLayer = doc.layers.add({name:"SLUG"});)

Definition of document slug greatness of space

doc.documentPreferences.documentSlugUniformSize = false;

doc.documentPreferences.slugBottomOffset = "20 mm";

Open the InDesign file to the library that contains the file of slug

var slugLibrary = app.open(File("/Users/Shared/Slug.indl"));

Place the slug script go here

var myPlacedAsset = slugLibrary.assets.item ("Slug");

var mySlug = myPlacedAsset.placeAsset (doc);

Close the library of slug

slugLibrary.close ();

Move the object of slug to the slug area

mySlug.move([0,0]);

Layer of locking SLUG

slugLayer.locked = true;

placeAsset is an array, then this line: mySlug.move([0,0]);

Replace: mySlug [0].move([0,0]);

Tags: InDesign

Similar Questions

Maybe you are looking for