🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20537

Re: AS: Creation of an index from a text file

#20537
From: Shane Stanley
Date: Tue, 18 Jun 2002 10:43
41 lines
2117 bytes
in article ef91ff0.4@WebX.aaQKaf7vad4, Olivier Berquin wrote:

> Ok, If I search the word "hammer", your script stop on the second page ! On
> the first page, no text frame, and on the second one, the word "hammer" appear
> in 3 text frames.
> 

I see the problem now: my simple test document had only text frames, but the
script fails trying to search other page items. So I think you're going to
have to use something like this:

tell application "InDesign 2.0.1"
 set thePages to {}
 tell document 1
  repeat with i from 1 to count of pages
   try -- in case none on page
    set itemClass to class of all page items of page i
    set allItems to all page items of page i
    set theFrames to {}
    repeat with j from 1 to count of allItems
     if item j of itemClass = text frame then
      set end of theFrames to item j of allItems
     end if
    end repeat
    set x to search theFrames for "hammer"
    try
     x
     set end of thePages to i
    end try
   end try
  end repeat
 end tell
end tell

More complicated than it should be, I fear.

Wish list items: whose clause support with "all page items", and a "parent
page" property for page items.

-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <B9354BF8.338F0%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef91ff0.-1@WebX.aaQKaf7vad4> <ef91ff0.4@WebX.aaQKaf7vad4>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,dba5b3be0840d143
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-06-18 04:11:18 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-06!supernews.com!iad-peer.news.verio.net!news.verio.net!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: AS: Creation of an index from a text file
Message-ID: <B9354BF8.338F0%sstanley@myriad-com.com.au>
Date: Tue, 18 Jun 2002 03:43:37 -0700
References: <ef91ff0.-1@WebX.aaQKaf7vad4> <ef91ff0.4@WebX.aaQKaf7vad4>
Lines: 47
User-Agent: Microsoft-Outlook-Express-Macintosh-Edition/5.0.3
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit