Smooth Auto-Replace Functionality in EmEditor, A Premier Text Editing Software

Smooth Auto-Replace Functionality in EmEditor, A Premier Text Editing Software

Kenneth Lv8

Smooth Auto-Replace Functionality in EmEditor, A Premier Text Editing Software

Viewing 2 posts - 1 through 2 (of 2 total)

  • Author
    Posts
  • November 7, 2009 at 2:15 pm #7796
    WmMitchell
    Participant
    I posted this in the regex group, which might have been a mistake. I think that it might actually be better here.
    I’m not getting consistent results with the S&R macro below. If I don’t put:
    document.selection.StartOfDocument(false);
    shell.SendKeys(“{CTRL DOWN}{CTRL UP}”);
    a lot in the document to periodically force the cursor to the top of the document being edited, the macro doesn’t replace _all_ items, even though I have put the option eeReplaceAll in every single S&R instance. Even forcing the cursor up to the top of doesn’t make the S&R perform consistently and I have to manually invoke this script 2 or 3 times.
    ————————————————————
    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);
    ————————————————————
    I saw an example of a macro in what looks like an old forum for EmEditor and subsituted eeFindNext for eeFindReplaceQuiet, but that didn’t make the macro work repeatedly until all instances found and fixed.
    What can be done to ensure the macro “loops” through each function until done, pls?
    Thanks!
    November 8, 2009 at 6:29 pm #7803
    Yutaka Emura
    Keymaster

    WmMitchell wrote:
    I posted this in the regex group, which might have been a mistake. I think that it might actually be better here.

    I’m not getting consistent results with the S&R macro below. If I don’t put:

    document.selection.StartOfDocument(false);
    shell.SendKeys(“{CTRL DOWN}{CTRL UP}”);

    a lot in the document to periodically force the cursor to the top of the document being edited, the macro doesn’t replace _all_ items, even though I have put the option eeReplaceAll in every single S&R instance. Even forcing the cursor up to the top of doesn’t make the S&R perform consistently and I have to manually invoke this script 2 or 3 times.

    ————————————————————
    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);
    ————————————————————

    I saw an example of a macro in what looks like an old forum for EmEditor and subsituted eeFindNext for eeFindReplaceQuiet, but that didn’t make the macro work repeatedly until all instances found and fixed.

    What can be done to ensure the macro “loops” through each function until done, pls?

    Thanks!
    “eeFindNext | eeReplaceAll” should be enough, and you shouldn’t use shell.SendKeys(“{CTRL DOWN}{CTRL UP}”);.
    Can you simplify your test program and a sample file, and email me at [email protected] ? I will try to reproduce your problem, and fix it if it is a bug of EmEditor.
    Thank you.

  • Author
    Posts

Viewing 2 posts - 1 through 2 (of 2 total)

  • You must be logged in to reply to this topic.

Also read:

https://techidaily.com
  • Title: Smooth Auto-Replace Functionality in EmEditor, A Premier Text Editing Software
  • Author: Kenneth
  • Created at : 2024-10-09 16:15:59
  • Updated at : 2024-10-14 16:00:12
  • Link: https://win-help.techidaily.com/smooth-auto-replace-functionality-in-emeditor-a-premier-text-editing-software/
  • License: This work is licensed under CC BY-NC-SA 4.0.
On this page
Smooth Auto-Replace Functionality in EmEditor, A Premier Text Editing Software