How do I position an InDesign object using Javascript?


Question

I'm working on a calendar in InDesign and I have a circle object (oval) that I want to position over the day of the month:

enter image description here

I'm pretty sure it should be possible to write a script that sets the x,y position properties of the oval object on each page to the proper values. I've already got the seven x values and the 6 y values that make up the month-grid, but I'm very new to JavaScript so I don't know how to get started. The sample scripts I saw were very involved, and I think what I want to do is much simpler, albeit with some iterations, etc.

If anyone can help me script the basics to get me started I would greatly appreciate it.

1
0
9/16/2016 10:19:00 PM

Yes, it is possible to position an InDesign object via scripting. First you need to somehow adress the oval, so you can later move it. If it is the only oval on the spread you can use

var myOval = app.activeWindow.activeSpread.ovals.firstItem();

to save the oval in the variable myOval.

Afterwards you can just use

myOval.move([x, y]);

to move the oval into its position. Is this enough info to get you started?

3
9/16/2016 11:28:00 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow


Website under construction!!!
^