EmEditor (text editor) Forum Index
   Regular Expressions
     How to do the S&R automatically always without user intervention?
Register To Post

Threaded | Newest First Previous Topic | Next Topic | Bottom
Poster Thread
WmMitchell
Posted on: 11/1/2009 10:14 am
Just popping in
Joined: 11/1/2009
From:
Posts: 5
How to do the S&R automatically always without user intervention?
I'm not very good at regex, but I've managed to get some code going that more or less works, at least, most of the time. But I'm wondering why some parts search and replace without any manual intervention, and other text isn't and it stops and I must press a key to initiate the S&R.

Here's part of the code in question. All of it has the same structure, so I'm at a loss ... All the extra, clunky keystrokes I had to put it to get it to work but I'm sure there must be a more efficient means of continuous, automated S&R throughout an entire document (?):


------------------------------------------------------------
document.selection.StartOfDocument(false);
shell.SendKeys("{CTRL DOWN}{CTRL UP}");

document.selection.Replace(". ",". ",eeFindNext | eeReplaceAll);
document.selection.Replace(". ",". ",eeFindNext | eeReplaceAll);
document.selection.Replace(". ",". ",eeFindNext | eeReplaceAll);
document.selection.Replace(". ",". ",eeFindNext | eeReplaceAll);
document.selection.Replace(". ",". ",eeFindNext | eeReplaceAll);
document.selection.Replace("? ","? ",eeFindNext | eeReplaceAll);
document.selection.Replace("? ","? ",eeFindNext | eeReplaceAll);
document.selection.Replace("! ","! ",eeFindNext | eeReplaceAll);
document.selection.Replace("! ","! ",eeFindNext | eeReplaceAll);
document.selection.Replace(": ",": ",eeFindNext | eeReplaceAll);
document.selection.Replace(": ",": ",eeFindNext | eeReplaceAll);
document.selection.Replace("Dr. ","Dr. ",eeFindNext | eeReplaceAll);
document.selection.Replace("Mr. ","Mr. ",eeFindNext | eeReplaceAll);
document.selection.Replace("Mrs. ","Mrs. ",eeFindNext | eeReplaceAll);
document.selection.Replace("Lt. ","Lt. ",eeFindNext | eeReplaceAll);

document.selection.StartOfDocument(false);
shell.SendKeys("{CTRL DOWN}{CTRL UP}");
document.selection.Replace("1/4","¼",eeFindNext | eeReplaceAll);
document.selection.StartOfDocument(false);
shell.SendKeys("{CTRL DOWN}{CTRL UP}");
document.selection.Replace("1/2","½",eeFindNext | eeReplaceAll);
document.selection.StartOfDocument(false);
shell.SendKeys("{CTRL DOWN}{CTRL UP}");
document.selection.Replace("3/4","¾",eeFindNext | eeReplaceAll);
------------------------------------------------------------

Thanks!
Threaded | Newest First Previous Topic | Next Topic | Top


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