5 Replies Latest reply on Apr 9, 2009 10:49 AM by Jeremy bowmangraphics-DQuh1B

    Reversed name appears in index under 'Symbol' rather than 'A','B','C'...

    Jeremy bowmangraphics-DQuh1B Level 3



      I wrote a simple script that quickly adds a (first-level) topic and page reference to an index. It seemed to work OK, so I got ambitious and tried to write another script, this time one that reverses the order of a Firstname and Surname where there's a space between them. But now, although the name is duly reversed, it appears in the Index Panel under 'symbol' rather than the first letter of the Surname.


      I'd be very grateful for any help.


      Thanks, Jeremy



      var myDocument = app.activeDocument;

      var myIndex = myDocument.indexes.item(0);

      var myMarker = app.selection[0];

      var myText = myMarker.contents;

      var myDialog = app.dialogs.add({name:"Add index entry with range to End of Document",canCancel:true});



      var myTextEditField = textEditboxes.add({editContents:myText, minWidth:200});



      var myResult = myDialog.show();


      if(myResult == true){

      var myIndexTerm = myTextEditField.editContents;


      var myBreak = myIndexTerm.indexOf(' ');

      var mySurName = myIndexTerm.slice(myBreak);

      var myFirstName = myIndexTerm.slice(0, myBreak);

      var myReversedName = mySurName + ", " + myFirstName;

      var myTopic = myIndex.topics.add(myReversedName);



      myTopic.name = myReversedName;