TextPad Macro works in Editor but not from Menu [solved]

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
User avatar
Mr. Code Monkey
Posts: 24
Joined: Thu Jul 30, 2009 4:59 am

TextPad Macro works in Editor but not from Menu [solved]

Post by Mr. Code Monkey »

I recorded a simple macro but it does not work.

Then I finally found the macro editor (hidden in the preferences) and not only does the look correct, it validates and runs perfectly from the editor.

Alas we cannot keep the macro editor open and still work in our document. And the macro still silently fails to do anything when run from either the menu or the "Multi-Play" dialog.

Tried both "Selection" and "To end of file" as the macro scope.

I'm using TextPad 8.10.0, 64 bit, on Windows 10.

For reference, the macro is:

Code: Select all

# SearchReplace
Replace = "Like", " Like", RegExp, InSelection
DoReplaceAll
# SearchReplace
Replace = "\\n\\n", "\\n", RegExp, InSelection
DoReplaceAll
# SearchReplace
Replace = "\\n\\+", "   \\+", RegExp, InSelection
DoReplaceAll
Last edited by Mr. Code Monkey on Sat Feb 12, 2022 3:33 am, edited 2 times in total.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

Did you mean
I recorded a simple macro but it does not seem to work.
?

You set the option InSelection.
Did you make a selection before you ran the macro?
User avatar
Mr. Code Monkey
Posts: 24
Joined: Thu Jul 30, 2009 4:59 am

Post by Mr. Code Monkey »

Yes and yes.

Also, from the macro editor, making a selection was not necessary when the macro was set to either "end of file" or "document", despite the

Code: Select all

InSelection
parameter in the code.

The script always runs fine from the macro editor but not the menu.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Post by ben_josephs »

I can't reproduce the symptoms you describe (with TextPad version 8.9.0 or 8.10.0). Sorry I can't help.
User avatar
AmigoJack
Posts: 533
Joined: Sun Oct 30, 2016 4:28 pm
Location: グリーン ヒル ゾーン
Contact:

Post by AmigoJack »

Maybe you should try to reproduce it yourself afresh? Start a new document and tell us what to fill in to then either run your macro or open the macro editor, so we should be able to reproduce your "doesn't work" and "works" experience.

There's always the chance that it works as intended, but your expectations are just wrong, like: all replacements would have been made, but nothing matched. Or no text was selected.
User avatar
Mr. Code Monkey
Posts: 24
Joined: Thu Jul 30, 2009 4:59 am

Post by Mr. Code Monkey »

Okay, I shutdown and restarted TextPad and now the macro does appear to work, BUT I won't get some more of the critical text, to test, for a few more hours.

Alas, I made two troubleshooting mistakes:
  1. I assumed that because TextPad normally seems stable for weeks at a time, that the memory instance was not corrupted. It now obviously was.
  2. I failed to save the exact text that I need it to work on (generated once a day by a website). I'll have more of that text in 6 hours. The macro does now work on approximations of the text (it didn't before) but there may be Unicode shenanigans that weren't accounted for.
User avatar
Mr. Code Monkey
Posts: 24
Joined: Thu Jul 30, 2009 4:59 am

Post by Mr. Code Monkey »

Got fresh text and verified the macro works from the menu.

Purging TextPad from memory and restarting it was the cure.
Post Reply