8 Replies Latest reply: May 24, 2011 11:45 PM by Green4ever RSS

    Need to add any Pointer/Bookmark for the Hyphenated words

    aanavaras

      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.

       

      SaRaVaNaN.N

        • 1. Re: Need to add any Pointer/Bookmark for the Hyphenated words
          sudar1983_14 Community Member

          Hi Saravan,

           

          Find all the hyphenated items and store as a dictionary.

           

          0->re-uploaded

          1->num-ber

           

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

           

           

          Arivu..

          • 2. Re: Need to add any Pointer/Bookmark for the Hyphenated words
            pkahrel CommunityMVP

            In this thread: http://forums.adobe.com/message/2933158#2933158 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.

             

            Peter

            • 3. Re: Need to add any Pointer/Bookmark for the Hyphenated words
              aanavaras Community Member

              Hi Arivu,

               

              Thanks for your suggestion.

               

              Its not shows only Hyphenated words. It finds some more occorances also like, paragraph's last line contains less than 8 chrs, hyphen at end of page, etc.

               

              I found everything. my actual need is i hav to set some mark to the founded text & while clicking on the listbox, i have to jump there.

               

              So i have to do something more than this.

               

               

              Can you help me on this?

              • 4. Re: Need to add any Pointer/Bookmark for the Hyphenated words
                aanavaras Community Member

                Dear Peter,

                 

                 

                I founded the list of hyphenated words successfully.


                i hav to set some reference mark to the founded text & return to there while clicking

                • 5. Re: Need to add any Pointer/Bookmark for the Hyphenated words
                  sudar1983_14 Community Member

                  Is it same project or separate projects?

                   

                   

                  Arivu..

                  • 6. Re: Need to add any Pointer/Bookmark for the Hyphenated words
                    aanavaras Community Member

                    Its Same Project.


                    Checking the Validation points of the active InDesign document & reports in a ListBox.


                    While clicking i have to go the refered point.

                    • 7. Re: Need to add any Pointer/Bookmark for the Hyphenated words
                      aanavaras Community Member

                      Since, i didn't get any update on this, and failed to do by myself, I created a log file with page and paragraph number of the Occurrences and told the users to go there manually.

                      • 8. Re: Need to add any Pointer/Bookmark for the Hyphenated words
                        Green4ever Community Member

                        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(); 
                        //------------------------------------------------    
                        main();
                        times2 = new Date().valueOf();
                         var timeTaken = ((times2-times1)/1000);
                        displayWindow();
                        if (myCounter > 0){
                        w.show();
                        }
                        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);
                                        myCounter++;
                                        }//End if
                                    }//End of Find Length
                                }//End Story length
                            //alert(myIndex.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];
                                    app.select (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;
                        }
                        

                        --------

                        Green4ever