Article View: adobe.scripting.indesign
Article #19526Re: Reference vs. Object Reference
From: Shane Stanley
Date: Sun, 15 Dec 2002 21:56
Date: Sun, 15 Dec 2002 21:56
42 lines
2254 bytes
2254 bytes
On 16/12/02 8:31 AM +1000, Dave Saunders, daves@pdsassoc.com, wrote:
> I guess that a reference is an AppleScript entity while an object reference is
> an InDesign entity.
Yes. A reference stores just what you put in it, but an object reference
gives you a reference based on the ID object model. Try this:
tell application "InDesign 2.0.2"
tell document 1
set x to object reference of text frame 1
set y to a reference to text frame 1
{x, y}
end tell
end tell
You'll get something like:
{text frame id 143 of page id 119 of spread id 114 of document "Untitled-1"
of application "InDesign 2.0.2", text frame 1 of document 1 of application
"InDesign 2.0.2"}
> One practical difference is demonstrated by this pair of scripts. The first
> doesn't work, the second does
In the first one, your reference is resolved into a list of object
references, which are then passed to the search command, which doesn't want
to be passed a list. In the second, the reference is passed unresolved to
the command, which then happily resolves it itself.
Scratched record time: lots of these problems go away if you avoid needless
storing of either kind of reference, and deal with objects directly:
tell application "InDesign 2.0.2"
tell every document
search for " " replacing with " "
end tell
end tell
--
Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<BA2345B2.47CA3%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de70458.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,abd789129a3f14c3 X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2002-12-15 14:08:03 PST From: Shane Stanley <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-03!sn-xit-01!sn-xit-09!supernews.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: Reference vs. Object Reference Message-ID: <BA2345B2.47CA3%sstanley@myriad-com.com.au> Date: Sun, 15 Dec 2002 13:56:19 -0800 References: <1de70458.-1@WebX.la2eafNXanI> Lines: 51 User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.6 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit