Tagged: Macro Script OutputBar RegEx
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- April 26, 2013 at 11:08 am #10995yakMember
var strAnswer = prompt( "find waht ?", "w+" ); var count=0; while ( document.selection.Find( strAnswer, eeFindNext | eeFindReplaceRegExp) ) { count++; } OutputBar.Clear(); OutputBar.writeln( "find count: "+count ); OutputBar.Visible = true; OutputBar.SetFocus();
serach document by regex which you input,find and print match counts
October 15, 2013 at 2:25 am #17282StefanParticipantGood example of utilizing “OutputBar”, thanks.
If you are interested, you can modify your script with some details like shown here:
// do not update the screen during our work: Redraw = false; // get and store current cursor position: yPos = document.selection.GetActivePointY( eePosLogical ); xPos = document.selection.GetActivePointX( eePosLogical ); // ask the user: var strAnswer = prompt( "find what ?", "\\w+" ); // do the work; search for occurrences: var count=0; while ( document.selection.Find( strAnswer, eeFindNext | eeFindReplaceRegExp) ) { count++; } // provide the result to the output bar: OutputBar.Clear(); OutputBar.writeln( "find count for \"" + strAnswer + '\" after column ' + xPos + ' of row ' + yPos + ': ' + count ); OutputBar.Visible = true; OutputBar.SetFocus(); // erase search highlighting: document.HighlightFind = false; // go back to origin cursor position: document.selection.SetActivePoint( eePosLogical, xPos, yPos, false );
Keep up! ;-)
- AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)
- You must be logged in to reply to this topic.