Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Moving ruler origin, setting reference point etc.

Explorer ,
Aug 19, 2014 Aug 19, 2014

Hi,

I'm quite new to scripting InDesign. I'm doing a script that moves and duplicates various page items. My problem comes in when the user has moved the ruler origin it messes up my script.

How, within a script, can you set the ruler origin back to the top left of the page/spread?

Also, when using a pageItem.move(to) method or pageItem.duplicate(to) method, how do you know whether you're using a top-left reference/anchor point or a centre-centre reference point etc?

Thank you!

Nicolas

TOPICS
Scripting
2.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Aug 19, 2014 Aug 19, 2014

1. RulerOrigin sets whether the ruler is relative to the page or spread (or spine, which I heartily dis-recommend for normal use ...). This enumeration is used (see the bottom) in 'ViewPreference.rulerOrigin', and 'ViewPreference' in turn is used as "Document.viewPreferences". That gives you the line

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

This sets the relative position. The absolute zero point can be set through a document property: Document.zeroPoint ("The ru

...
Translate
Community Expert ,
Aug 19, 2014 Aug 19, 2014

1. RulerOrigin sets whether the ruler is relative to the page or spread (or spine, which I heartily dis-recommend for normal use ...). This enumeration is used (see the bottom) in 'ViewPreference.rulerOrigin', and 'ViewPreference' in turn is used as "Document.viewPreferences". That gives you the line

app.activeDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;

This sets the relative position. The absolute zero point can be set through a document property: Document.zeroPoint ("The ruler origin, specified as page coordinates in the format [x, y]"):

app.activeDocument.zeroPoint = [ 0,0 ];

2. The methods that need a proxy location all accept an AnchorPoint, which can be one of the "Left", "Top", "Right Center" and so on as in the on-screen proxy.

But if you check the PageItem,move command, you can see there is nothing there on 'anchor point'. It seems this command only uses the top left anchor for "to" (for movement by it's irrelevant which corner you use). The same is true for PageItem.duplicate.

If you want to experiment and play around a bit, you can read the 'current' setting from the Control Panel as "LayoutWindow.transformReferencePoint":

alert ("Current setting is "+app.layoutWindows[0].transformReferencePoint);

which shows either one of the long numbers on AnchorPoint, or for newer versions of InDesign, if I'm not mistaken, the full name.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 19, 2014 Aug 19, 2014
LATEST

Thanks so much!

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines