EmEditor 宏:拷贝查找内容到新文件

随手写的一个宏,满足自己的需求。
有需要的朋友可以直接使用,无版权 ^-^

/*
 * Author:       641
 * Version:      0.1
 * Description: 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;

你可能感兴趣的:(JavaScript)