Skip to main content
Community Expert
January 18, 2024
Answered

Set Zero Point ruler to the selected object - script help

  • January 18, 2024
  • 2 replies
  • 540 views

Trying my best to setup scripts but can't figure this out - everything I try moves the object not the Zero Point reference for the ruler.

 

Is it possible to script the Zero Point to be set to Zero and the top left of a selected object.

For reference, I'll be basing everything a selected distance from this. 

 

I just can't get the ruler zero point to snap to the object.

 

 

This topic has been closed for replies.
Correct answer Peter Kahrel

Resetting the zeropoint seems to work. Also, I got the y point wrong in the earlier code:

app.activeDocument.zeroPoint = [0,0];
gb = app.selection[0].geometricBounds;
app.activeDocument.zeroPoint = [gb[1], gb[0]];

2 replies

Peter Kahrel
Community Expert
Peter KahrelCommunity ExpertCorrect answer
Community Expert
January 18, 2024

Resetting the zeropoint seems to work. Also, I got the y point wrong in the earlier code:

app.activeDocument.zeroPoint = [0,0];
gb = app.selection[0].geometricBounds;
app.activeDocument.zeroPoint = [gb[1], gb[0]];
Peter Kahrel
Community Expert
Community Expert
January 18, 2024

Select the text frame, then do this:

 

 

app.activeDocument.zeroPoint = [0,0];
gb = app.selection[0].geometricBounds;
app.activeDocument.zeroPoint = [gb[1], gb[0]];

 

 

Community Expert
January 18, 2024

Yeh I was nowhere near that solution mine was about 27 lines of code 

Thank you so much - the simple things are eluding me completely! 

😮

Robert at ID-Tasker
Legend
January 18, 2024

I think you also have to remember about RulerOrigin property: