Professional Documents
Culture Documents
????????????????????????????????????????????????????????????????????????????????
//DESCRIPTION: Index from word list
// Peter Kahrel -- www.kahrel.plus.com
/*
16 Nov. 2011: fixed bug that chopped off word-final s
*/
paragraph_styles = "";
//paragraph_styles = "|def|sec";
// Replace index?
replace_index = true;
/*--------------------------------------------------------------------------
------------------------------------------------------------------------------*/
index_from_list ();
function index_from_list ()
{
var listName = environment_check();
set_find_options();
var list = get_list (app.documents.item(listName));
//app.activeDocument.close (SaveOptions.yes);
var displ = init_progress ();
displ.show();
index_documents (list, listName, displ);
}
// Take an item from the word list and create a search item:
// split word-list item on comma. If that fails,
// split on parenthesis. If that fails too, return the whole item.
// Wrap string in word-boundary markers and
// prefix the case-insensitive code, if necessary.
function environment_check ()
{
if (app.documents < 2)
errorM ('Open a word list and \rthe documents to be indexed.')
var listDocName = findTopicList();
if (listDocName == null)
errorM ('Open the document with the topics to be marked (it should have "topic list" in its
name)');
// The list document is now the active document
if (app.documents.item(listDocName).pages[0].textFrames.length != 1)
errorM ('The list document should have one text frame on the first page -- not more, not fewer.');
return listDocName;
}
function findTopicList() {
var docs = app.documents.everyItem().getElements();
for (var i = docs.length-1; i >= 0; i--) {
if (docs[i].name.toUpperCase().replace(/[\x20_]/g,"").indexOf('TOPICLIST') > -1) {
return docs[i].name;
}
}
return null;
}
function set_find_options ()
{
app.findGrepPreferences = app.changeGrepPreferences = null;
app.findChangeGrepOptions.includeLockedLayersForFind = false;
app.findChangeGrepOptions.includeLockedStoriesForFind = false;
app.findChangeGrepOptions.includeHiddenLayers = true;
app.findChangeGrepOptions.includeMasterPages = false;
app.findChangeGrepOptions.includeFootnotes = true;
}
function init_progress ()
{
var w = new Window ('palette', 'Concordance');
w.alignChildren = ['left', 'top'];
w.docName = w.add ('statictext', undefined, '------');
w.docName.characters = 40;
w.pbar = w.add ('progressbar', undefined, 1, 50);
w.pbar.preferredSize = [270,20];
return w;
}
???????????????????????????????????????????????????????????????????????????????
1. Save the above file in .js or .jsx extension and put the file in the following folder -
C:\Program Files\Adobe\Adobe InDesign CC 2018\Scripts\Scripts Panel
2. Create a indesign file named ‘topic list’ and type all words one by one without comma(,)
and save the file
4. Then right click the java script file (index_topics_list.js ) and run the file.
5. Open the Index - goto Window->Type & Table->Index - In the index panel click the generate
index.
Index_topics_list.js
The above js file is in my google drive
https://drive.google.com/file/d/14xUIDJPjk3EBn6J3sFBfEryFF0S2Dl7O/view?usp=sharing