Macros Broken

General questions about using TextPad

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

Post Reply
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Macros Broken

Post by Drxenos »

I have several macros set up to comment-out the selected lines in various languages (i.e., C++, Ada, bash, etc.).

They'd worked for years, but with the latest versions of TextPad, they ignore the selection and affect the whole document.

Doing it manually through the replace dialog box still works correctly.

For an example, here is the macro I have setup for bash (and others that use '#' as a line commenter):

Code: Select all

Replace = "^", "#", RegExp, InSelection
DoReplaceAll
I tried recreating the macro, in case the syntax has changed, but it's identical.

Thanks,
DrX
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Re: Macros Broken

Post by ben_josephs »

I was going to post something similar.

Here is a macro to open a line at the current cursor position.
If the cursor is placed before the second "stuff" in the text

Code: Select all

stuff_before_cursor stuff_after_cursor
then running the macro should change the text to

Code: Select all

stuff_before_cursor
                    stuff_after_cursor
The following macro used to work, but now it obliterates everything except the last line of the document.

Code: Select all

EditDupLine
LineLeftExtend
# SearchReplace
Replace = ".", " ", RegExp, InSelection
DoReplaceAll
CharRight
LineUp
LineEndExtend
EditDelete
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Re: Macros Broken

Post by Drxenos »

Thank you for the confirmation, Ben!
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Macros Broken

Post by bbadmin »

DrXenos' macro will work if its default scope is set to Selection, like this:

MacroEditor.png
MacroEditor.png (51.82 KiB) Viewed 6482 times

Looking into ben_josephs' one.
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Re: Macros Broken

Post by Drxenos »

That worked. Thank you! I've never bothered to set the scope before because "InSelection" seemed to take care of it. I will from now on.
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Macros Broken

Post by bbadmin »

If the scope is set to "Document", any selection is cleared before running the macro. This change was made to allow macros which made their own selection to be repeated with the Multi-play command.
ben_josephs
Posts: 2461
Joined: Sun Mar 02, 2003 9:22 pm

Re: Macros Broken

Post by ben_josephs »

BTW, I'm using TextPad version 8.16.1.

I changed the scope of my macro to Selection. Then if there is no selection when I run it, it doesn't do anything at all (and no action that can be undone is recorded). And if there is a selection when I run it, it does something that is only vaguely like what it should be doing.
User avatar
Drxenos
Posts: 209
Joined: Mon Jul 07, 2003 8:38 pm

Re: Macros Broken

Post by Drxenos »

bbadmin wrote: Sun May 28, 2023 2:00 pm If the scope is set to "Document", any selection is cleared before running the macro. This change was made to allow macros which made their own selection to be repeated with the Multi-play command.
Got it. Thank you!
User avatar
bbadmin
Site Admin
Posts: 879
Joined: Mon Feb 17, 2003 8:54 pm
Contact:

Re: Macros Broken

Post by bbadmin »

ben_josephs, please check your PMs.
Post Reply