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

Create index reference entry with only cross reference by Script

Engaged ,
Aug 24, 2018 Aug 24, 2018

Hello everyone!

to create an index reference entry without number page, I mean only with the cross-reference, like this:

human (see also beings)

person glossary

...

I need manually create a new entry with a Custom Cross-reference and add this manually:

Screen Shot 2018-08-24 at 21.36.42.png

Screen Shot 2018-08-24 at 21.39.52.png

but I need create hundreds. Please do you know a script to create a Custom Cross-reference?

Thanks so much.

TOPICS
Scripting
519
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

correct answers 1 Correct answer

Advocate , Sep 10, 2020 Sep 10, 2020

Today I am replying on this thread Because I was also searching for the same.

I am replying for other needy person who might be looking for such script

////////////////////////////////////////////////////////////////////////////////////////////

///// For this sample script I am making this sample array for incoming data
var indexArray = [["Human","1st","Index)"],["Person","2nd","Index"],["Third","3rd","Index"],["Fourth Index","4th","Index"],["Fifth","5th","Index"]];
//=============================

...
Translate
Advocate ,
Sep 10, 2020 Sep 10, 2020
LATEST

Today I am replying on this thread Because I was also searching for the same.

I am replying for other needy person who might be looking for such script

////////////////////////////////////////////////////////////////////////////////////////////

///// For this sample script I am making this sample array for incoming data
var indexArray = [["Human","1st","Index)"],["Person","2nd","Index"],["Third","3rd","Index"],["Fourth Index","4th","Index"],["Fifth","5th","Index"]];
//=================================================================
var myDoc = app.documents[0];
try{
    myDoc.indexes.everyItem().topics.everyItem().remove();
    }
catch(e){}
var index = myDoc.indexes.add();
var customRef = null;
for(var i = 0; i < indexArray.length; i++){
    topic = index.topics.add(indexArray[i][0]);
    customRef = index.topics.add(indexArray[i][1]);
    topic.crossReferences.add(customRef, CrossReferenceType.CUSTOM_CROSS_REFERENCE, indexArray[i][2]);
    }
//=================================================================

////////////////////////////////////////////////////////////////////////////////////////////

Best

Sunil

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