[Bug] Running macro multiple times fails, line by line works
-
Hey all, 7.5.6 64 bit here on windows 10. Having a file of some 35 lines in format:
val:descr
Which I want to flip to:
descr = val,
So I did a fast macro:
<Macro name=“buggy” Ctrl=“no” Alt=“no” Shift=“no” Key=“0”>
<Action type=“0” message=“2442” wParam=“0” lParam=“0” sParam=“” />
<Action type=“0” message=“2177” wParam=“0” lParam=“0” sParam=“” />
<Action type=“0” message=“2180” wParam=“0” lParam=“0” sParam=“” />
<Action type=“0” message=“2451” wParam=“0” lParam=“0” sParam=“” />
<Action type=“1” message=“2170” wParam=“0” lParam=“0” sParam=" " />
<Action type=“1” message=“2170” wParam=“0” lParam=“0” sParam=“=” />
<Action type=“1” message=“2170” wParam=“0” lParam=“0” sParam=" " />
<Action type=“0” message=“2179” wParam=“0” lParam=“0” sParam=“” />
<Action type=“1” message=“2170” wParam=“0” lParam=“0” sParam=“,” />
<Action type=“0” message=“2300” wParam=“0” lParam=“0” sParam=“” />
<Action type=“0” message=“2453” wParam=“0” lParam=“0” sParam=“” />
</Macro>
When I run it on line by line by leaving some time between clicks - everything is fine. If I click faster, or run it till the end of file - at least 3-4 lines are corrupted. Haven’t seen this behavior with previous versions of notepad++. Any idea? -
Hello, Anton, and All,
If you want to run your
buggy
macro,Nth
times, be sure that :-
The cursor is located at the very beginning of the first line
val:descr
-
A physical line-break (
CR+LF
orLF
) exists at the end of thenth
line
As for me, I did not notice that issue ! Even, holding down the
3
keys of the assigned shortcut (Ctrl + Shift + =
), the macro changes each line, one after another, without any trouble ;-)Here is, below, my code of the
buggy
macro, with N++v7.5.6
, on an ( old ! ) Win XP SP3 system<Macro name="buggy" Ctrl="yes" Alt="yes" Shift="no" Key="187"> <Action type="0" message="2442" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2177" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2180" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2451" wParam="0" lParam="0" sParam="" /> <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " /> <Action type="1" message="2170" wParam="0" lParam="0" sParam="=" /> <Action type="1" message="2170" wParam="0" lParam="0" sParam=" " /> <Action type="0" message="2179" wParam="0" lParam="0" sParam="" /> <Action type="1" message="2170" wParam="0" lParam="0" sParam="," /> <Action type="0" message="2300" wParam="0" lParam="0" sParam="" /> <Action type="0" message="2453" wParam="0" lParam="0" sParam="" /> </Macro>
A second and faster solution could be to execute a Search/Replacement, with the the litteral strings, in normal search mode, on all text of a previous selection. So :
-
First, select your block of
val:descr
lines -
Open the Replace dialog (
Ctrl + H
) -
Find what :
val:descr
-
Replace with:
descr = val,
-
Tick the
In selection
option -
Select the
Normal
search mode -
Click on the
Replace All
button
Voilà !
Best Regards,
guy038
-