Highlighted

Create index reference entry with only cross reference by Script

Engaged ,
Aug 24, 2018

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

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

TOPICS
Scripting

Views

288

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

Create index reference entry with only cross reference by Script

Engaged ,
Aug 24, 2018

Copy link to clipboard

Copied

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.

Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

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

TOPICS
Scripting

Views

289

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
Aug 24, 2018 0
Adobe Community Professional ,
Sep 10, 2020

Copy link to clipboard

Copied

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

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 10, 2020 0