Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

[AS-CS3] How to create subtopics in an index?

New Here ,
Dec 03, 2008 Dec 03, 2008
I wrote a script whose make an index from character styles.
I guy ask to me:
"We've just had a print customer ask us for help w/ their index --- I've got it worked out except for adding sub-topics, sub-sub-topics and (of course) sub-sub-sub-topics."

I don't write scripts for a long time (due to my work).
Is it possible to make that???

I thing the short answer is "no", but...

Thanks.

Oli.
TOPICS
Scripting
1.2K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Participant ,
Dec 03, 2008 Dec 03, 2008
You can certainly make such topics from a script, but how does the script know which is a sub-topic of what?

Dave
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 03, 2008 Dec 03, 2008
The script in question knows how many levels there are (stored in the variable ``howMany'') and has the index terms in indexone through indexfour --- all I need is the more complicated versions of:

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
end if

where set myTopic adds indexone (as a level1 topic) _and_ indextwo as a sub-topic to indexone and then makes a page reference, &c. (for sub-sub-topics and sub-sub-sub-topics, indexthree and indexfour respectively).

William
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
Hi William,

Funny to see here!
Like Dave said, I "must" to know the topic of the word...
I "must" to know that "setter" is a dog, and not a cat...

Maybe we can try to make -- for each word searching from a character style --, a dialog with "wich level?", and an other one with every words of this level.

So, in my opinion, it's more simple to make this in Indesign without script... This is the same works for the user...

Oli.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
If it was just one or two or a dozen index entries or so, but there are thousands of entries.

If one has the selected text in MyFoundItem, and has parsed it to:

main topic == indexone
how many index entries there are == howMany
sub-topic == indextwo
sub-sub-topic == indexthree
sub-sub-sub-topic == indexfour

Surely one can then add a topic and a page reference using AppleScript. If not, why not?

William
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
Here's a message I'm about to post to the applescript-list (my apologies for those who're seeing it twice):

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

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?

William
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
Hi William,

My apologize if I make a mistake about your question...
To enter a sub-topic, you MUST have the name of the topic.
For example, I want to "index" the word "bicyle" into the topic "transportation". In InDesign, it's very simple, I know that the bicycle is a way of transportation. "I" know that.

Now, thing about Applescript.
How the machine knows that the bicycle is a way of transportation, and not a system of cooking?

I've right? (don't know, in english, if it is "I've right" or "I'm right"???)

Oli.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
In English one would more likely pose it as a question, ``Am I right?'' If you wanted to make the statement it would be ``I'm right.'' (not sure why the order flops between the forms though).

The indexing data has all of that.

It has transportation in indexone and bicycle in indextwo (and howMany is 2 and myFoundItems contains the text:

transportation
bicycle

so that one knows where the page reference goes.

All that I need is the code that handles there being 2, 3 or 4 levels, e.g.:

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 that doesn't work and I can't see why it doesn't).

Please believe me that the InDesign document will be fully populated w/ thousands of index entries as text formatted however I specify --- all I need is a script which finds them and inserts the multi-level index topics and page references.

William
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Dec 04, 2008 Dec 04, 2008
LATEST
I finally figured out the magic incantation --- you have to add the topic to a topic.

Thanks!

William
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines