home *** CD-ROM | disk | FTP | other *** search
- !!script
- //@Created build 475 mg20001218 (Miguel Angel Rojas Gonzalez)
-
- var gOutput = getOutput();
-
- function DoCommand()
- {
- var editor = getActiveEditor();
- if ( editor )
- {
- var selection = editor.getSelection();
- var text = editor.copy( selection );
-
- if ( text.length == 0 )
- {
- return;
- }
-
- var findData = chooseReplaceParameters( "Replace in Selection" );
-
- if ( findData )
- {
-
- findData.startCharIndex = selection.startCharIndex;
- findData.startLineIndex = selection.startLineIndex;
-
- editor.findNext( findData );
-
- while ( findData && findData.found )
- {
- if (findData.startCharIndex >= selection.endCharIndex && findData.startLineIndex >= selection.endLineIndex)
- {
- break;
- }
- else
- {
- editor.replace( findData.getReplaceValue(), findData );
- }
-
- editor.findNext( findData );
- }
-
- gOutput.clear();
- gOutput.writeLine( "Searching for: '" + findData.key + "', Replacing with: '" + findData.getReplaceValue() + "' whithin: \n\n" + text );
- gOutput.writeLine( "Replace in Selection done");
-
- editor.setActive("Replace in Selection");
- }
- }
- }
-
- !!/script
-
-