Viewing 1 post (of 1 total)
  • Author
    Posts
  • #7771
    WmMitchell
    Participant

    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!

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.