Notepad++ macro not working correctly
I have the TextFX plugin, and one of its functions is convert text to proper case.
I used the shortcut mapper and set the shortcut in the plugin commands tab.
The shortcut works without an issue but when I record it as a macro I get something that looks more like a serialized export.
Can anyone help me get this working?
Im having the exact same issue. I’ve also updated to the lates NP++ and its still happeneing. Very odd.!
I have noticed that “TextFX” has no [alt+] menu access short cut - for example [alt+F] = file menu. maybe the macro doen’t know where to get the commands from because tecnically there is no menu for TextFX?
Hello Walkerbo Belf and Lord Lethris,
Yes, you’re right ! Notepad++ does NOT handle the TextFX menus, properly and recording macros,that includes TextFX commands seems useless :-((
However, the following regex S/R can emulate the Proper Case feature :
Find what :
Replace with :
Refer to the link, below, for explanations on the case modifiers
And, here is, below, the corresponding macro, with the Alt + Ctrl + Shift + P shortcut, created in the shortcuts.xml configuration file :
<Macro name="Proper Case" Ctrl="yes" Alt="yes" Shift="yes" Key="80"> <Action type="3" message="1700" wParam="0" lParam="0" sParam="" /> <Action type="3" message="1601" wParam="0" lParam="0" sParam="(\w)(\w*)" /> <Action type="3" message="1625" wParam="0" lParam="2" sParam="" /> <Action type="3" message="1602" wParam="0" lParam="0" sParam="\u\1\L\2" /> <Action type="3" message="1702" wParam="0" lParam="640" sParam="" /> <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" /> </Macro>
So, as soon as you select the menu option Macro - Proper Case, or hit the corresponding shortcut, any selected text is changed, in a Proper Case way !
Refers to the documentation, below, for a detailed information :
Thus, you may insert all the lines, above, beginning by
<Action type="3", in that order, in an existing macro, to add a Proper Case action, on selected text, to this macro :-)).
Just close N++, open Shortcuts.xml with an OTHER editor, save the changes and re-start N++ !
Click on that link, below, for a discussion about the main capitalization rules :
Let’s suppose the Test sentence, below :
You're very happy to spend a week in the Mary's cottage
With TextFX OR with my previous regex S/R, that sentence is changed into :
You'Re Very Happy To Spend A Week In The Mary'S Cottage
But, if you prefer the nicer form, below :
You're Very Happy To Spend A Week In The Mary's Cottage
just use the following regex :
Find what :
Replace with :
This regex does NOT change all English contracted forms, as
If a contracted form is matched, as group 1, in the second part of tha alternative does NOT exist, it is just rewritten (
$0) as is
If a classical range of word characters are matched, group 1 exists and the word is changed :
With its first letter, in uppercase way (
With its subsequent letters, in a lowercase way (