Copy link to clipboard
Copied
When I paste an object on a page I need to reposition it to get to an exact X and Y position. I am doing this manually on a few hundred pages because the pasted object never falls in the right position, and to alter the X and Y each time is very time consuming.
Is there a scripting solution that will allow me to click on the object and run the script so that it positions the object to the desired X/Y coordinates? I cannot find one that has already been written. In summary, I want to click on the object and then run a script that positions it at X = 105.75mm and Y = 76.754mm. Can anyone help please?
app.selection[0].move (['105.75mm', '76.754mm']);
A better solution would be to create an object style and make it the default style for graphics (or text, whichever your pasted objects are). In the object style you set the location, and on pasting the object should be placed correctly.
It would be even easier if there's an alyernative to pasting the object, such as duplicating it.
Copy link to clipboard
Copied
app.selection[0].move (['105.75mm', '76.754mm']);
A better solution would be to create an object style and make it the default style for graphics (or text, whichever your pasted objects are). In the object style you set the location, and on pasting the object should be placed correctly.
It would be even easier if there's an alyernative to pasting the object, such as duplicating it.
Copy link to clipboard
Copied
Thanks very much, Peter. I still need to learn about object styles, but you short script worked fine once I changed the co-ordinates a bit. I have an A4 page and paste one object into the top half, and one into the bottom half. When I paste them the top one 'lands' at 54.623mm (X) and 76.026mm(Y). I adapted your script to ['27.036', '7.886mm'] and the object moves to just where it should be (i.e. 105.75mm(X) and 76.754mm(Y)).
When I paste the bottom one it 'lands' at 54.623mm (X) and 209.376mm(Y). I adapted your script this time to ['27.036', '152.264mm'] and the object moves to just where it should be (i.e. 105.75mm(X) and 221.132mm(Y)).
I run these as two seperate scripts depending upon whether I'm dealing with the top object or the bottom object, and it all works exactly right. So thanks again for showing me the way to do this.
Copy link to clipboard
Copied
I made a mistake when I typed the co-ordinates. The object in the top half 'lands' at 54.623mm (X) and 71.126mm(Y). I adapted your script to ['27.036', '7.886mm'] and the object moves to just where it should be (i.e. 105.75mm(X) and 76.754mm(Y)).
When I paste the bottom one it 'lands' at 54.623mm (X) and 189.659mm(Y). I adapted your script this time to ['27.036', '152.264mm'] and the object moves to just where it should be (i.e. 105.75mm(X) and 221.132mm(Y)).
I must admit I cannot find the relationship to calculate the numbers (it was all done my trial and error until I got the 'new' coordinates to move the object to the right position. Anyway, thanks again!
I run these as two seperate scripts depending upon whether I'm dealing with the top object or the bottom object, and it all works exactly right. So thanks again for showing me the way to do this.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Hi,
Thank you for the post! I am often finding the need to move text frames on a long document where the margins have been changed or the document wasn't setup properly to begin with (i.e. the master pages)
I note a relevant post elsewhere on the forum: How to reposition linked text frames?
app.selection[0].move (['105.75mm', '76.754mm']);
What would the script be if I wanted to move frames in position [x1, y1] to [x2, y2] AND frames in position [x3, y3] to [x4, y4]?
For example, condsider a book document where all the frames are out of position -- the verso frames need to be treated in one way and the recto frames in another.
A better solution would be to create an object style and make it the default style for graphics (or text, whichever your pasted objects are). In the object style you set the location, and on pasting the object should be placed correctly.
I cannot see "location" in the object styles ... is this a feature available in newer versions of InDesign?
The following image shows the Object Styles dialogue in my version.
I am using CS6 (InDesign 8.0), Windows 11
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Thank you @Robert at ID-Tasker , from the screen shot in the article it appears older versions of InDesign do not have the "Size and Position Options" within the Object Style settings.
If Size and Position Options can be selected then presumably they could be manipulated through an object find/replace also.
Copy link to clipboard
Copied
As you work on a PC - I would suggest CS6 version of my ID-Tasker tool - not free but if you have a lot of mundane clicking to do every day...