• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
How does one add a sub-topic (or sub-sub-topic, or sub-sub-sub-topic) to an InDesign index?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How does one add a sub-topic (or sub-sub-topic, or sub-sub-sub-topic) to an InDesign index?


  • Subject: How does one add a sub-topic (or sub-sub-topic, or sub-sub-sub-topic) to an InDesign index?
  • From: William Adams <email@hidden>
  • Date: Thu, 4 Dec 2008 08:06:36 -0500

I'm trying to up-date Olivier Berquin's script (located somewhere near):

http://olivier.berquin.free.fr/indesign/indesign_cs1.html

so that it will make multi-level indexes.

I'm currently working in CS2 (but I don't think the indexing code has changed much since then), and have managed to get to the point where I have:

FoundObjects -- a list of all the things which need to be indexed
myFoundItem --- the thing which I want to index
howMany --- the number of index levels (1, 2, 3, or 4)
indexone --- the main topic
indextwo --- the sub-topic (if any)
indexthree --- the sub-sub-topic (if any)
indexfour --- the sub-sub-sub-topic (if any)

Olivier's script has:

tell myIndex
-- Add the topic to the index if it does not already exist.
try
set myTopic to topic indexone of myIndex
on error
set myTopic to make topic with data {name:indexone}
end try
end tell
tell myTopic
make page reference with properties {parent story:myStory, source text:myFoundItem}
end tell


(which I have wrapped up in an if howMany is 1 then .... endif block)

to check and see if an index entry exists and make it if it doesn't, but I'm simply not understanding how one would code adding a sub- topic, sub-sub-topic or sub-sub-sub-topic and the page reference to the last topic --- I just need to fill in the last three code blocks (if howMany is 2, 3 or 4 then ... endif) --- how do I do that?

I've tried lots of variations on:

if howMany is 2 then
tell myIndex
-- Add the topic to the index if it does not already exist.
try
set myTopic to topic indexone of myIndex
on error
set myTopic to make topic with data {name:indexone}
end try
try
tell topic indexone of myTopic
set myTopic to topic indextwo of myIndex
end tell
on error
tell topic indexone of myTopic
set myTopic to make topic with data {name:indextwo}
end tell
end try
end tell
tell myTopic
make page reference with properties {parent story:myStory, source text:myFoundItem}
end tell
end if


But no joy.

If all else fails, I've found code for adding sub-topics using JavaScript, so could fall back on that (either by re-writing the entire script or just calling via do script), but I'd prefer a pure AppleScript solution.

Please don't tell me to just do it by hand. There're thousands of entries and this job needs to be re-done every year.

William

--
William Adams
senior graphic designer
Fry Communications


_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden
  • Follow-Ups:
    • Re: How does one add a sub-topic (or sub-sub-topic, or sub-sub-sub-topic) to an InDesign index?
      • From: William Adams <email@hidden>
  • Prev by Date: Sequential renumbering in InDesign CS3
  • Next by Date: Re: Renaming multiple files
  • Previous by thread: Re: Sequential renumbering in InDesign CS3
  • Next by thread: Re: How does one add a sub-topic (or sub-sub-topic, or sub-sub-sub-topic) to an InDesign index?
  • Index(es):
    • Date
    • Thread