🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: adobe.scripting.indesign
4 messages
4 total messages Started by Alex_Zedd Fri, 30 Jan 2009 16:25
Findout Page coordinates of a frame.
#1558
Author: Alex_Zedd
Date: Fri, 30 Jan 2009 16:25
16 lines
1280 bytes
Hello.

Writing Java scripts for the Indesign CS3.
Enumerate through the xml content and get the image and text frames.
Need to detect Page coordinates of them.

When I wrote the same code in c++, I was get pasteboard coordinates of the rectangle and page, substract results and get necessary shift for rectangle coordinates. But now, when I use a script, I do not know, how to get pasteboard coordinates of the page.

For Frames I have find out the string:

"myFrame.resolve([[myFrame.bounds[1], myFrame.bounds[0]], AnchorPoint.TOP_LEFT_ANCHOR], CoordinateSpaces.PASTEBOARD_COORDINATES);"

But even here I'm not sure in the right order of the bounds[0 & 1].
How to get the page coordinates of a frame?

Thank's for your notice.
Re: Findout Page coordinates of a frame.
#1573
Author: Olav_Kvern
Date: Fri, 30 Jan 2009 19:36
9 lines
1299 bytes
Hi Alex,

CoordinateSpaces.pasteboardCoordinates is the global measurement system--that is, it extends behind all pages and all spreads, and it is always in points, regardless of your current units of measurement. Is that really what you want?

If you're working with objects that have not been transformed (scaled or rotated), then it's usually easier to work with geometricBounds, which returns the bounds of the object in current ruler units, in the form: y1, x1, y2, x2. If you set your ruler origin to page origin, then the values you get back will match those you see in the user interface (in the Control panel and the Transform panel). Is that what you're looking for?

Thanks,

Ole
Re: Findout Page coordinates of a frame.
#1595
Author: Alex_Zedd
Date: Sun, 01 Feb 2009 16:33
6 lines
752 bytes
Thank you, very match, Olav.

"myDocument.viewPreferences.rulerOrigin = RulerOrigin.PAGE_ORIGIN;"

helps.
Best Regars and good luck!.
Re: Findout Page coordinates of a frame.
#1651
Author: Harbs
Date: Sun, 01 Feb 2009 21:30
13 lines
957 bytes
Hmm.

I never noticed that resolve function before! I could probably come up 
with some scenarios where it would be useful!

FWIW, visibleBounds is usually better than geometricBounds. It works on 
transformed objects as well.

Thanks.

-- 
Harbs
http://www.in-tools.com
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads