🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #2326

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

#2326
From: Ola_Khrapatin
Date: Fri, 26 Dec 2008 16:45
27 lines
2145 bytes
Hi, thanks for the quick reply!

I tryed the revised version and it worked by itslef, so I guess that really was the missing link.

Now, when I combined these 2 lines inside the bigger version, it failed to work. This is the script (Do you have any idea what's the bug?):

//InDesign CS3 Javascript
//Not working properly. Supposed to combine 2 different index markers into a single index marker containing 1 page range
//according to the original index markers location
//The real script has loops and counters, here I simplified it to see what exactely went wrong:

myIndex = app.activeDocument.indexes.item(0);
myTopics = myIndex.topics;
myTopic1 = myTopics.item(0);
myPara1 = myTopics.item(0).pageReferences.item(0).sourceText.paragraphs.item(0);
//The location of the first index marker:
myPara1Place = myPara1.parent.texts.itemByRange(0, myPara1.index).texts.item(0).paragraphs.length;
myTopic2 = myTopics.item(1);
myPara2 = myTopics.item(1).pageReferences.item(0).sourceText.paragraphs.item(0);
//The location of the second index marker:
myPara2Place = myPara1.parent.texts.itemByRange(0, myPara1.index).texts.item(0).paragraphs.length;
//sets the page reference to refer to a page range based on paragraphs:
myTopic1.pageReferences.item(0).pageReferenceType = PageReferenceType.forNextNParagraphs;
myLimit = myPara2Place - myPara1Place;
myTopic1.pageReferences.item(0).pageReferenceLimit = myLimit;
//Removes the second and uneeded topic
myTopic2.pageReferences.item(0).remove();
Technical Details
Message-ID: <59b75803.7@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.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!news1.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.7@webcrossing.la2eafNXanI>
Date: Fri, 26 Dec 2008 08:45:41 -0800
References: <59b75803.-1@webcrossing.la2eafNXanI>
Lines: 36
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit