Skip to main content
May 13, 2016
Answered

Move page by x-coordinates (page tool)

  • May 13, 2016
  • 4 replies
  • 1484 views

I wondered if anyone can help.

I have a single page document which I use the "app.activeDocument.pages.add();" code to add a second page next to it, but, I then need to move the second page across by 30mm to leave a margin between the pages. Manually I would use the "Page Tool (Shift+P)" but not sure how to move it by script.

Thankful for any help with this, Bren

This topic has been closed for replies.
Correct answer

Ok, I have it working,

I start off with a 'Main-Master' as my document and when I need to add another page with a gap between the two I run the script below.

My 'Master pages' are set in millimetres:    'A-Master' 190(w) x 269(h)    'B-Master' 30(w) x 269(h)

// Add spine page and second main page - then delete spine to leave gap

app.activeDocument.pages.add ({appliedMaster: app.activeDocument.masterSpreads.item('A-Master')});

app.activeDocument.pages.add ({appliedMaster: app.activeDocument.masterSpreads.item('B-Master')});

app.activeDocument.pages[1].remove ();

This Adds a thin width page then a full width page after page 1, then deletes the thin page to leave a 30mm gap.

Many thanks everyone for all your help, Bren

4 replies

Correct answer
May 16, 2016

Ok, I have it working,

I start off with a 'Main-Master' as my document and when I need to add another page with a gap between the two I run the script below.

My 'Master pages' are set in millimetres:    'A-Master' 190(w) x 269(h)    'B-Master' 30(w) x 269(h)

// Add spine page and second main page - then delete spine to leave gap

app.activeDocument.pages.add ({appliedMaster: app.activeDocument.masterSpreads.item('A-Master')});

app.activeDocument.pages.add ({appliedMaster: app.activeDocument.masterSpreads.item('B-Master')});

app.activeDocument.pages[1].remove ();

This Adds a thin width page then a full width page after page 1, then deletes the thin page to leave a 30mm gap.

Many thanks everyone for all your help, Bren

May 14, 2016

Thank you both for replying, I have tried to apply the logic and I have read through the guides but I'm afraid at this point (only started scripting under 2 weeks ago) most of it is still out of reach for me to write the Java script from scratch. Thanks for your replies, I will keep trying to work it out and searching for scripts that I may be able to modify to make this work.

Thanks, Bren

Inspiring
May 16, 2016

I have decided to write this up as the subject for my next week's blog (yourscriptdoctor.com/blogs) as I believe other users may also find this information useful. The blog will be released as of Monday, May 16. Sample scripts will be written in both AppleScript and ExtendScript. Hope you find this helpful.

May 16, 2016

Hi Shirley,

Thanks for your reply, I have gone through the script on your yourscriptdoctor.com/blogs (will be going back on there soon to check out your other scripts, they are very well explained thanks), but I'm still unable to get a gutter between the 2 pages as I do with the 'Page Tool'. (Have added a screen grab below)

The reason I need the gutter is I have tabs that use the 'odd page' and 'even page' text break that define the side of the page they appear on and these need to be in clear air (not touching another page), if they touch the page next to them, they disappear.

I'm wondering if I am unable to move a page on its x-coordinates, whether I could use your script but then delete the smaller pg2 but get page 3 to stay in it's position, leaving a gutter on a 2 page document.

Many Thanks, Bren

Vamitul
Legend
May 13, 2016

This is what you are looking for:

Page

and this is the guide for understanding that:

Indiscripts :: Coordinate Spaces & Transformations in InDesign — Chap.1-3

Inspiring
May 13, 2016

My take on this would be to have spread 1  create 2 pages: the first to add the amount of move (resize the width of this to the amount of move using resize), the second to add your second page.

Steps for this would be as follows:

have document create a new master spread (masterB)

set allow page shuffle for spread 1 to false

have spread 1 create a new page (page2)

set the applied master of page2 to masterB

set the margin preferences of page2 to 0 for top, left, bottom, right

resize page2 using inner coordinates from left center anchor by replacing current dimensions by (amount of move, original page height)

have spread 1 create a new page (page3)

set the applied master of page3 to masterB

Hope this is what you wanted.