🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #14886

Re: [AS to JS] Reference script

#14886
From: Peter_Kahrel
Date: Thu, 15 Jan 2004 14:33
25 lines
1982 bytes
How do you know that

hyp[i].destination.destinationText.parentTextFrame.parent.name

contains the page number?

I didn't. But I knew that the parent of a text frame is an object of type Page, and that the name of the page is the page number. In this case we need somehow to connect an object of type Hyperlink with an object of type Page. To figure out that connection you need the debugger, the scripting guide, common sense, and perseverance. In the guide, under "hyperlink", you see that objects of type Hyperlink have a property "destination" and that this is an object. But an object of what type? You find out by typing the following line in the debugger's console:

hyp[0].destination

The debugger will say:

Result: [object HyperlinkTextDestination]

Now you look under hyperlinkTextDestination in the guide, where you see that it has a property "destinationText", which is an insertion point. You can check this by entering this in the debugger's console:

hyp[0].destination.destinationText

And indeed the debugger reports this:

Result: [object InsertionPoint]

Now that you have an insertion point you can ask which text frame it is in. Then you get the parent of the textframe, which is an object of type Page, and you're there. And check Dave Saunders's tutorials, they're very helpful.

Peter
Technical Details
Message-ID: <2ccf57a5.5@webx.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2ccf57a5.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,d2827867f6cc8388
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2004-01-15 06:38:14 PST
From: Peter_Kahrel@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: Re: [AS to JS] Reference script
Message-ID: <2ccf57a5.5@webx.la2eafNXanI>
Date: Thu, 15 Jan 2004 06:33:26 -0800
References: <2ccf57a5.-1@webx.la2eafNXanI>
Lines: 37
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit