🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2324

Re: CS3 Javascript - finding the paragraph which contain the index page reference

#2324
From: Ola_Khrapatin
Date: Fri, 26 Dec 2008 15:44
27 lines
2024 bytes
Hi,

it seems your lines should have solved the issue, but I usually get an error saying "object is invalid" on the second line. It works only if I remove the end:
myPara = app.activeDocument.indexes.item(0).topics.item(0).pageReferences.item(0).sourceText.paragraphs[0]
myPcount = myPara.parent.texts.itemByRange(0, myPara.index)//.paragraphs.length;

Did you try to run these lines and it worked fine?

You know, I think I write the bigger picture:

I am getting a Word file to typeset with index markers inside. The only problem is that Word recognizes PAGE RANGES, while InDesign does not (I mean the ones coming from Word). So my text editor and I agreed on specail "signs" to show where a page range begings and ends.
For example:
INDEX
DogsYYY, 15
DogsZZZ, 20

When I see this I know i need to change the index marker in InDesign to be like that:
INDEX
Dogs, 15-20

Now, when you do it on 1, 2, 3 index markers, it is not so bad. But if you do it on hundreds of them - the fun stops ;) pretty crazy, ha?

So the goal is to make a script to do this simple mechanical action. And this is the bigger picture. I didn't find anything on the internet for it, which is quite surprising... Doesn't anyone else get their text from Word with index markers and page ranges?

Anyway, any sort of help will be greatly appriciated, as I am a *bit* closer to desperate.

Ola
Technical Details
Message-ID: <59b75803.5@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
References: <59b75803.-1@webcrossing.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,4423827cf06ba747
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: Ola_Khrapatin@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: Re: CS3 Javascript - finding the paragraph
 which contain the index page reference
Message-ID: <59b75803.5@webcrossing.la2eafNXanI>
Date: Fri, 26 Dec 2008 07:44:16 -0800
References: <59b75803.-1@webcrossing.la2eafNXanI>
Lines: 40
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit