0

我正在使用 emeditor 宏代码 ExtractLinesContain.jsee(从 emeditor 宏库下载)在文本文件中搜索某些文本。这段代码完美无缺。它正在将结果粘贴到新文件中。但我希望将结果复制到剪贴板,也应该发送到 potplayer。上述代码需要三处修改。

  1. 使用分隔符“|”输入多个文本。我想用“,”代替“|”。
  2. 搜索结果自动复制到搜索结果中。
  3. 将以下代码附加到上述宏代码中。editor.ExecuteCommandByID(4445); WshShell = new ActiveXObject("WScript.Shell");

WshShell.Run("PotPlayerMini64.exe /clipboard");

请帮我。

4

1 回答 1

0

ExtractLinesMulti.jsee宏非常古老,我改用 EmEditor 的批量查找/提取功能重写这是提取包含任何指定多个字符串的行的宏,这些字符串由 分隔|

if( !editor.EnableTab ){ 
   editor.EnableTab = true; 
   alert( "Please run this macro again." ); 
   Quit(); 
}

sFind = prompt( "This macro extracts lines that do contain any of the specified multiple strings separated by |:", "" );
if( sFind == "" ){
    Quit();
}

var sArr = sFind.split("|");
batch_list = editor.filters;
for( i = 0; i < sArr.length; ++i ) {
    batch_list.AddFind(sArr[i],eeFindReplaceCase,0);
}
document.selection.BatchFind(batch_list, eeFindExtract | eeFindLineOnly,0);

document.selection.SelectAll();  // select all text
document.selection.Copy(eeCopyUnicode);  // copy the seleciton to the Clipboard

您可以在此宏的末尾添加任何您想要的代码。

参考资料:http ://www.emeditor.org/en/macro_selection_batch_find.html

于 2020-09-11T15:31:59.500 回答