🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #20538

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

#20538
From: Shane Stanley
Date: Tue, 18 Jun 2002 10:54
48 lines
2225 bytes
in article ef91ff0.5@WebX.aaQKaf7vad4, Olivier Berquin wrote:

> Here is a little test:
> -- 
> tell application "InDesign 2.0"
> tell document 1 
> set WordList to search in every text frame for "Hammer"
> --> WordList 
> -- > item 1 : text from character 1 to character 7 of text flow id 5968 of
> document "perel test"
> -- > item 2 : text from character 1 to character 7 of text flow id 15020 of
> document "perel test"
> end tell 
> end tell 
> -- 
> 
> Now, how can I have the page number of these two items ?

First, searching "in every text frame" will not get any that are part of a
group. But you could use this method anyway:

tell application "InDesign 2.0.1"
 set thePages to {}
 tell document 1
  set theFinds to search for "hammer"
  try
   repeat with aFind in theFinds
    set theParent to parent of parent text frame of character 1 of aFind
    repeat while class of theParent is not in {page, spread}
     set theParent to parent of theParent
    end repeat
    if class of theParent is spread then
     -- what to do?
    else
     set thisPage to name of theParent -- or use index
     if thePages does not contain thisPage then
      set end of thePages to thisPage
     end if
    end if
   end repeat
  end try
 end tell
end tell

I'm not sure which would be the quickest.

-- 
Shane Stanley,  sstanley@myriad-com.com.au
Technical Details
Message-ID: <B9354E6D.338F1%sstanley@myriad-com.com.au>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-08!supernews.com!isdnet!proxad.net!fr.clara.net!heighliner.fr.clara.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <ef91ff0.-1@WebX.aaQKaf7vad4> <ef91ff0.5@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-08!supernews.com!isdnet!proxad.net!fr.clara.net!heighliner.fr.clara.net!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: <B9354E6D.338F1%sstanley@myriad-com.com.au>
Date: Tue, 18 Jun 2002 03:54:06 -0700
References: <ef91ff0.-1@WebX.aaQKaf7vad4> <ef91ff0.5@WebX.aaQKaf7vad4>
Lines: 53
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