🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #15765

InDesign CS Indexing (JavaScript, but applicable to alllanguages)

#15765
From: Richard_Ronnback
Date: Fri, 14 Nov 2003 03:24
57 lines
2895 bytes
Thanks for sharing that information.

I might have a project coming up which will involve database-driven index
generation, so this will really be helpful then.

Thanks again



On 03-11-13 23.28, in article 2cce6115.-1@webx.la2eafNXanI,
"Olav_Kvern@adobeforums.com" <Olav_Kvern@adobeforums.com> wrote:

> Gang--
> 
> Scripting the creation of index topics with subtopics can be a real
> brain-twister. When you look at the InDesign CS object model, you'll see that
> the index object has a topics collection, and that you can tell the index to
> add a topic:
> 
> 
> 
> //given an index "myIndex"
> var myTopic = myIndex.topics.add("Mammals");
> 
> So far, so good. Next, we can see that topics include a subtopics collection,
> and that we can add a subtopic as follows:
> 
> var mySubtopic = myTopic.subtopics.add("Bats");
> 
> The subtopic "Bats" shows up on the "Mammals" topic, just as one would expect.
> Let's say we want to add a further subtopic--now things get confusing (at
> least for me). Here's what doesn't work:
> 
> var myTopic = myIndex.topics.add("Mammals");
> var mySubtopic = myTopic.subtopics.add("Bats");
> var mySubSubTopic = myTopic.subtopics.add("Vampire");
> 
> The above script produces the index topics "Mammals, Bats," and "Mammals,
> Vampire," when what we wanted was "Mammals, Bats, Vampire." It took me (and
> Stan Somers, another Adobe guy) a while to figure out the right approach
> (Stan's the one who really got it to work). Here it is:
> 
> var myTopic = myIndex.topics.add("Mammals");
> var mySubtopic = myTopic.subtopics.add("Bats");
> var mySubSubTopic = mySubtopic.parent.subtopics.add("Vampire");
> 
> What the...? Aren't myTopic and mySubtopic.parent the same object? As it turns
> out, they're not. When you tell myTopic to create mySubtopic, what you're
> really doing is creating *another topic*. It's that topic, not myTopic, that
> you want to have create the subtopic.
> 
> Hope this helps any poor soul who's been trying to create index topics via
> scripting!
> 
> Thanks,
> 
> Ole
Technical Details
Message-ID: <BBDA0987.1C716%richard.ronnback@telia.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webx
References: <2cce6115.-1@webx.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,289ff5ae7c36f46a
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2003-11-13 19:37:56 PST
From: Richard_Ronnback@adobeforums.com
Path: arc1-ca.pugleaf.net!archiver1.google.com!news2.google.com!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!proxad.net!newsfeed.tpinternet.pl!newsfeed01.sul.t-online.de!t-online.de!webx
Newsgroups: adobe.scripting.indesign
Subject: InDesign CS Indexing (JavaScript, but applicable to alllanguages)
Message-ID: <BBDA0987.1C716%richard.ronnback@telia.com>
Date: Thu, 13 Nov 2003 19:24:39 -0800
References: <2cce6115.-1@webx.la2eafNXanI>
Lines: 71
User-Agent: Microsoft-Entourage/10.1.4.030702.0
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit