Highlighted

InDesign Scripting. Index with references to record numbers instead of page numbers.

Engaged ,
Sep 25, 2020

Copy link to clipboard

Copied

My document has a structure of library records with a classical multi-level index prepared.

Each record has a numbered list structure.

Indexed items are to indicate the position in the record instead of the page number.

For example.

Screen Shot 2020-09-25 at 21.02.41.png

 

Example of target index structure:

Ferguson Robert 3340/20, 3340/25,

France

-- Bibliographies de France 1451/4, 1451/8

Galiard F. 1451/1


Where 1451/1 is the record number, and the number after shash is a posiotn. 

Each postion of the record is marked with a separate Conditonal Text and has the name of the record and positon eg. "3340/20" etc.
So, each position of the record creates a separate section whose name is the name of the conditional text.

I want to search through the existing index and create a new topic for each page reference, which will be a copy of the actual topic + name of the conditional text in which it is referred to. And when creating a new topic, suppress the page range.


I have no idea how I can  I get the name the of the condtitional text while searching the index topics and page reference?


Or maybe there is another idea for it.

I have already managed to write this script.
First, I am searching the text to create a conditional text.
Then I create new topics from the old ones and delete the old ones.
Then I generate an index and sort, group and so on.

There is a lot of work ahead of me.
The script already works correctly on two levels of topics.
I still have levels 3 and 4 left.

I am calling back this way.

I search

 

indexes[0].allTopics
​

 so I had to go back to InsertionPoint.

topics[i].pageReferences[j].sourceText.appliedConditions[0].name​


I will write more when I can finish this.

 

I am a beginner coder rather than a programmer.
It helps me a lot to analyse your scripts.
Thanks for them!
Robert

 

TOPICS
How to, Scripting

Views

106

Likes

Translate

Translate

Report

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

InDesign Scripting. Index with references to record numbers instead of page numbers.

Engaged ,
Sep 25, 2020

Copy link to clipboard

Copied

My document has a structure of library records with a classical multi-level index prepared.

Each record has a numbered list structure.

Indexed items are to indicate the position in the record instead of the page number.

For example.

Screen Shot 2020-09-25 at 21.02.41.png

 

Example of target index structure:

Ferguson Robert 3340/20, 3340/25,

France

-- Bibliographies de France 1451/4, 1451/8

Galiard F. 1451/1


Where 1451/1 is the record number, and the number after shash is a posiotn. 

Each postion of the record is marked with a separate Conditonal Text and has the name of the record and positon eg. "3340/20" etc.
So, each position of the record creates a separate section whose name is the name of the conditional text.

I want to search through the existing index and create a new topic for each page reference, which will be a copy of the actual topic + name of the conditional text in which it is referred to. And when creating a new topic, suppress the page range.


I have no idea how I can  I get the name the of the condtitional text while searching the index topics and page reference?


Or maybe there is another idea for it.

I have already managed to write this script.
First, I am searching the text to create a conditional text.
Then I create new topics from the old ones and delete the old ones.
Then I generate an index and sort, group and so on.

There is a lot of work ahead of me.
The script already works correctly on two levels of topics.
I still have levels 3 and 4 left.

I am calling back this way.

I search

 

indexes[0].allTopics
​

 so I had to go back to InsertionPoint.

topics[i].pageReferences[j].sourceText.appliedConditions[0].name​


I will write more when I can finish this.

 

I am a beginner coder rather than a programmer.
It helps me a lot to analyse your scripts.
Thanks for them!
Robert

 

TOPICS
How to, Scripting

Views

107

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 25, 2020 0
Adobe Community Professional ,
Sep 28, 2020

Copy link to clipboard

Copied

Interesting problem. You'd need a script to do it. The script would work along these lines.

1. Don't generate InDesign's index. Instead, go through the topics. For each topic, create an object that uses the topic name as the key, the value is an array of the topic's record numbers and positions. (The topic's insertion point leads you to its paragraph, and from there you can get the record number/position.) These objects go into an array, so you end up with an array of objects.

 

2. Sort the array alphabetically, and sort each topic's array of record numbers. 

 

The best way to sort an index Marc Autret's script: 

https://www.indiscripts.com/post/2020/08/smartsort-1-05-new-design-new-options

 

For steps 1 and 2 you'd need a script writer (if you can't do it yourself), it's not exactly a trivial thing.

 

Peter

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 1
Engaged ,
Sep 28, 2020

Copy link to clipboard

Copied

I have already managed to write this script.
First, I am searching the text to create a conditional text.
Then I create new topics from the old ones and delete the old ones.
Then I generate an index and sort, group and so on.

There is a lot of work ahead of me.
The script already works correctly on two levels of topics.
I still have levels 3 and 4 left.

I am calling back this way.

I search

 

indexes[0].allTopics
​

 so I had to go back to InsertionPoint.

topics[i].pageReferences[j].sourceText.appliedConditions[0].name​


I will write more when I can finish this.

 

I am a beginner coder rather than a programmer.
It helps me a lot to analyse your scripts.
Thanks for them!
Robert

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 28, 2020 1