Article View: adobe.scripting.indesign
Article #14721[AS] Need a different page number search
From: McKinley_Media
Date: Mon, 19 Jan 2004 12:28
Date: Mon, 19 Jan 2004 12:28
37 lines
2820 bytes
2820 bytes
I've already got a couple of page number issues solved, but I'm having trouble with this one.
I'm trying to create an index in the back of a book with around 25,000 entries. I have created 2 files. The main document has the items with the page numbers I'd like to grab, the index document is where I'd like to place these page numbers.
Because there are so many numbers, I figured I'd better search page by page so my machine doesn't crash. I added a tab in front of the first page found, then a comma between additional pages found.
I am having trouble searching the main document after grabbing the items to be searched for from the index document. It choke when I tell it to search myDoc
Here's what I've done so far:
tell application "InDesign CS"
set myDoc to "Flying Heron:McKinley Media:McKinleyMediaDesign:Clients:Interplan:Directory:Directory.indd"
set myDoctorIndex to active document
repeat with myPage from 1 to (number of pages in myDoctorIndex)
set myCstyle to character style "[No character style]" of active document
set find preferences to nothing
set change preferences to nothing
set myParagraph to search every story of myDoctorIndex with find attributes {applied character style:myCstyle}
repeat with myParagraphIndex from 1 to (number of items in myParagraph)
set find preferences to nothing
set change preferences to nothing
set theSearchString to (item myParagraphIndex of myParagraph) as string
set myResult to search every story of myDoc for theSearchString
repeat with myPageResults from 1 to (number of items in myResult)
set myPageNumber to ((name of parent of parent text frame of item myPageResults of myResult) as number)
if myPageResults > 1 then
set (item myParagraphIndex of myParagraph) to (item myParagraphIndex of myParagraph) & "," & myPageNumber
else
set (item myParagraphIndex of myParagraph) to (item myParagraphIndex of myParagraph) & " " & myPageNumber
end if
end repeat
end repeat
end repeat
end tell
Technical Details
Message-ID:
<2ccf724e.-1@webx.la2eafNXanI>Path:
arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webxShow Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f939a,9f1314e2a5867bee,start X-Google-Attributes: gidf939a,public X-Google-ArrivalTime: 2004-01-19 04:37:34 PST From: McKinley_Media@adobeforums.com Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.media.kyoto-u.ac.jp!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!news.tele.dk!news.tele.dk!small.news.tele.dk!newsfeed.arcor-online.net!newsfeed01.sul.t-online.de!t-online.de!webx Newsgroups: adobe.scripting.indesign Subject: [AS] Need a different page number search Message-ID: <2ccf724e.-1@webx.la2eafNXanI> Date: Mon, 19 Jan 2004 04:28:24 -0800 Lines: 53 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit