EmEditor (text editor) Forum Index
   Questions and Answers about Macros
     My Macro: Copy Search Results To New document
Register To Post

Threaded | Oldest First Previous Topic | Next Topic | Bottom
Poster Thread
GRC
Posted on: 12/8/2010 6:50 am
Just popping in
Joined: 2/8/2010
From:
Posts: 6
Re: My Macro: Copy Search Results To New document
Thanks liushiyan. Very helpful.
liushiyan
Posted on: 9/26/2008 8:36 am
Just popping in
Joined: 9/26/2008
From:
Posts: 1
My Macro: Copy Search Results To New document
/*
* Author: 641
* Version: 0.1
* Descript: Copy Search Results To New document
*/

// move to StartOfDocument
document.selection.StartOfDocument();

// temp variable
var fullstr = '';

// error control
var error_control_num = 0;
var MAX_ERROR_NUM = 1000;

// get all search result
while(document.selection.FindRepeat(eeFindRepeatNext) && error_control_num < MAX_ERROR_NUM)
{
str = document.selection.Text;
fullstr = fullstr + '\n' + str;

error_control_num ++ ;
}

// copy to new file
editor.NewFile();
doc = editor.ActiveDocument;
doc.selection.Text = fullstr;
Threaded | Oldest First Previous Topic | Next Topic | Top


Register To Post
 
English čeština Deutsch español français italiano 日本語 한국어 Русский 简体中文 繁體中文