Skip navigation
aanavaras 41 posts
Mar 12, 2010
Currently Being Moderated

Need to add any Pointer/Bookmark for the Hyphenated words

Jul 6, 2010 12:06 AM

Dear Experts,


Im very new to Scripting.


I'm creating a Validation tool which shows hyphenated words in a ListBox & i done it well in VB6.


Now all my need is i have to jump to the location in the document while clicking the ListBox Item.



Is there any options to do this?


Looking forward your comments.


Thanks in advance.



  • Currently Being Moderated
    Jul 6, 2010 3:30 AM   in reply to aanavaras

    Hi Saravan,


    Find all the hyphenated items and store as a dictionary.





    Send the index item to the dictionary and get the value of the select item.




    Mark as:
  • Currently Being Moderated
    Jul 6, 2010 3:41 AM   in reply to aanavaras

    In this thread: you find some references to scripts that do exactly that. They're in JS but you should be able to see how to handle this. But if as you say you're very new to scripting, then this is probably too difficult.



    Mark as:
  • Currently Being Moderated
    Jul 6, 2010 5:24 AM   in reply to aanavaras

    Is it same project or separate projects?




    Mark as:
  • Currently Being Moderated
    May 24, 2011 11:45 PM   in reply to aanavaras

    Hi Try this code...

    I created this for windows XP, Indesign CS4.


    #targetengine "session";
    var myDoc = app.activeDocument;
    var stories = myDoc.stories.everyItem ().getElements ();
    var myFind = new Array(); var myCounter = 0;
    var times1, times2;
    times1 = new Date().valueOf();
    //-----------------------------For display---------------
    var w = new Window ("palette", "Hyphenated words");
    var list = w.add ("listbox", undefined, "", {numberOfColumns: 1, showHeaders: true,columnTitles: ["Hyphenated Word"], columnWidths: [185]});
        list.maximumSize.height = $.screens[0].bottom-200;
    var myStory_id = new Array(); var myitem_id = new Array(); 
    times2 = new Date().valueOf();
     var timeTaken = ((times2-times1)/1000);
    if (myCounter > 0){;
    else { alert("Double Hypehnation Not Found"); }
    function main(){
        var lineCount;
        myResetFindChangeGrep ();
        app.findGrepPreferences.findWhat = "(\\w+)([-~=])(\\w+)";
        var myIndex = new Array();
        for (i=0; i<stories.length; i++){
            myFind[i] = stories[i].findGrep(true);
            for (j=0; j<myFind[i].length; j++){
                lineCount = myFind[i][j].lines.length;
                if (lineCount>1){                
                    var story_id = i; var myFind_id = j;
                    var myText = myFind[i][j].contents;
                    addItem(myFind[i][j], i, j);
                    }//End if
                }//End of Find Length
            }//End Story length
    //------------------------Function Declarations--------------
    function displayWindow(){
        //window declared as global variable here 
        var panel1 = w.add('panel');
        panel1.minimumSize.width = 210;
        var group1 = panel1.add('group');
            group1.orientation ='row';
        var close_ = group1.add ("button", undefined, "Close", {name: "ok"});
        group1.add("statictext", undefined, "Fetched in "+timeTaken+" sec");
            close_.maximumSize.width = 44;
        list.onDoubleClick = function ()
                if (this.selection != null ) {
                var myIndex = this.selection.index;
                var storyNum = myStory_id[myIndex];
                var findNum = myitem_id[myIndex];
                var selectText = myFind[storyNum][findNum];
       (selectText, SelectionOptions.replaceWith);
                app.activeWindow.zoomPercentage = 200;
        close_.onClick = function () {w.close ()}
    function addItem(myItem, sto_id, item_id){
        list.add ("item", myItem.contents);
        myStory_id .push(sto_id);
        myitem_id .push(item_id);
    function myResetFindChangeGrep(){
        app.findGrepPreferences = NothingEnum.nothing;
        app.changeGrepPreferences = NothingEnum.nothing;
        app.findTextPreferences = NothingEnum.nothing;
        app.changeTextPreferences = NothingEnum.nothing;



    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points