Article View: adobe.scripting.indesign
Article #18303Re: AS - Is this a bug
From: Shane Stanley
Date: Sat, 05 Apr 2003 10:49
Date: Sat, 05 Apr 2003 10:49
31 lines
1936 bytes
1936 bytes
No, it's not a bug. To get a hint of why, run your first script, but add the line: get theItems at the end. You will see that all the references to text frames have been replaced by the string "Method 1". The reason is because when you use the "repeat with x in y" method, x contains a _reference_ to one of the items in y, as in "item z of y" -- it is not resolved. And "contents" is not just a property of a page item -- it's also a way to refer to the contents of an AS variable or item. So when you say: set contents of theItem to "Method 1" you're actually saying: set contents of item <whatever> of theItems to "Method 1" and that's what happens -- the contents of that particular item of the list is changed to "Method 1". It's a subtle distinction, and maybe eight times out of ten the two methods are interchangeable, but it's confusing when they aren't. So it's not a bad idea to stick with the second method all the time, or at least until you get your script working. -- Shane Stanley, sstanley@myriad-com.com.au
Technical Details
Message-ID:
<BAB4F1F4.54CC5%sstanley@myriad-com.com.au>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebXReferences:
<1de89b7d.-1@WebX.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,a4ae5830b29154bf X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2003-04-05 03:07:39 PST From: Shane Stanley <sstanley@myriad-com.com.au> Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-04!sn-xit-01!sn-xit-09!supernews.com!newshosting.com!news-xfer2.atl.newshosting.com!newsfeed.icl.net!newsfeed.fjserv.net!newsfeed.freenet.de!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX Newsgroups: adobe.scripting.indesign Subject: Re: AS - Is this a bug Message-ID: <BAB4F1F4.54CC5%sstanley@myriad-com.com.au> Date: Sat, 5 Apr 2003 02:49:57 -0800 References: <1de89b7d.-1@WebX.la2eafNXanI> Lines: 40 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