I am a textpad user who has been using it for a long time but I have limited understanding of it. I searched this forum for an answer but can't find it. Here is my problem:
I record a macro that looks for the word "DOG" and deletes any line with that word. Macro works fine until I do another F5 find for another word (let's say "CAT"). Then the macro will look for the word "CAT" How do I hard code the macro to look for the word "DOG" always, and not whatever word is in the F5 Find dialog?
I feel like this should be so obvious, but I simply can't figure it out.
Macro - how to hard code the Find search criteria
Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard
-
Pat Parker
- Posts: 4
- Joined: Mon Feb 20, 2012 2:51 am
In my experience TextPad always hard-codes the search string in a macro. I don't know how you even managed to create a macro that searches for a word other than the one that was entered when it was recorded.
Here's how I would record the macro you described:
1. Click Macros > Record.
2. Click Search > Find.
3. In Find what, enter DOG.
4. Click Find Next.
5. Click Close.
6. Click Edit > Delete > Line.
7. Click Macros > Stop Recording.
As far as I can tell, this macro will always search for "DOG" no matter what. How did you record your macro?
Here's how I would record the macro you described:
1. Click Macros > Record.
2. Click Search > Find.
3. In Find what, enter DOG.
4. Click Find Next.
5. Click Close.
6. Click Edit > Delete > Line.
7. Click Macros > Stop Recording.
As far as I can tell, this macro will always search for "DOG" no matter what. How did you record your macro?
-
ben_josephs
- Posts: 2464
- Joined: Sun Mar 02, 2003 9:22 pm
-
Dan_Sitar
Hi Pat Parker, ak47wong and ben_josephs,
I had the same problem before and I FIGURED IT OUT. You just have to tell TextPad HOW to Execute The Macro By Default when you save it. Therefore, select either “Repeat in the selection� OR “Repeat until the end of the file�. You have to remember the ‘words’ to act upon if I ask you to “repeat� the action, don't you?
More, you can ‘hard code’ many words—actions in the same macro. By example:
HOME
FIND “word_A� then REPLACE by “A_word�
HOME
FIND “word_B� then REPLACE by “WORD_b�
HOME
⌊√⌉ Check Regular Expressions
FIND “ \([a-f0-9]\{2\}\) � then REPLACE ALL by “ \x\U\1 �
etc.
Select “Repeat until the end of the file� before saving. Play with those Defaults to suit the type of the macro you are doing. Remember that you always can change the execution type by CTRL+F7.
Happy texpadding
Dan_Sitar &♭⁴∕₄║: ≷ . ♪ ♫♫|♫♩⌒♩. ͡ ♪⌢|♪‿♩ ♪♫‿♫‿|♫‿♫⌢| ̊⌒|♩ ז ♪ ♫♫:║
http://facebook.com/Dan.Bourdon
I had the same problem before and I FIGURED IT OUT. You just have to tell TextPad HOW to Execute The Macro By Default when you save it. Therefore, select either “Repeat in the selection� OR “Repeat until the end of the file�. You have to remember the ‘words’ to act upon if I ask you to “repeat� the action, don't you?
More, you can ‘hard code’ many words—actions in the same macro. By example:
HOME
FIND “word_A� then REPLACE by “A_word�
HOME
FIND “word_B� then REPLACE by “WORD_b�
HOME
⌊√⌉ Check Regular Expressions
FIND “ \([a-f0-9]\{2\}\) � then REPLACE ALL by “ \x\U\1 �
etc.
Select “Repeat until the end of the file� before saving. Play with those Defaults to suit the type of the macro you are doing. Remember that you always can change the execution type by CTRL+F7.
Happy texpadding
Dan_Sitar &♭⁴∕₄║: ≷ . ♪ ♫♫|♫♩⌒♩. ͡ ♪⌢|♪‿♩ ♪♫‿♫‿|♫‿♫⌢| ̊⌒|♩ ז ♪ ♫♫:║
http://facebook.com/Dan.Bourdon