Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #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!

    #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 tech@emurasoft.com ? I will try to reproduce your problem, and fix it if it is a bug of EmEditor.
    Thank you.

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum โ€˜Questions and Answers about Macrosโ€™ is closed to new topics and replies.