Community
    • Login

    Notepad++ macro not working correctly

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    macrotextfx
    5 Posts 4 Posters 5.3k Views 1 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Walkerbo BelfW Offline
      Walkerbo Belf
      last edited by

      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.

      Screen shot

      Can anyone help me get this working?

      Cheers

      1 Reply Last reply Reply Quote 1
      • Lord LethrisL Offline
        Lord Lethris
        last edited by Lord Lethris

        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?

        1 Reply Last reply Reply Quote 0
        • guy038G Online
          guy038
          last edited by

          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 : (\w)(\w*)

          Replace with : \u\1\L\2

          Refer to the link, below, for explanations on the case modifiers \u and \L :

          http://www.boost.org/doc/libs/1_48_0/libs/regex/doc/html/boost_regex/format/boost_format_syntax.html

          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 :

          http://docs.notepad-plus-plus.org/index.php/Editing_Configuration_Files#Search_.2F_Replace_encoding

          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++ !

          Best Regards,

          guy038

          P.S. :

          A)

          Click on that link, below, for a discussion about the main capitalization rules :

          https://notepad-plus-plus.org/community/topic/130/convert-case-to/4

          B)

          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 : '\w\w?\b|(\w)(\w*)

          Replace with : (?1\u\1\L\2:$0)

          Notes :

          • This regex does NOT change all English contracted forms, as 'd, 'll, 'm, 're, 's, 't, 've, …

          • 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 ( \u\1 )

            • With its subsequent letters, in a lowercase way ( \L\2 )

          1 Reply Last reply Reply Quote 1
          • Tarek FahamT Offline
            Tarek Faham
            last edited by

            I have the same problem, but I am using TextFX unescape “” to ". Any solution for this problem?

            1 Reply Last reply Reply Quote 0
            • guy038G Online
              guy038
              last edited by

              Hello, @tarek-faham,

              I’m a bit surprised because this kind of replacement is quite easy to process, even in normal search mode !

              SEARCH ""

              REPLACE "

              giving the new macro :

                      <Macro name='UnEscape &quot;&quot; to &quot;' Ctrl="no" Alt="no" Shift="no" Key="0">  <!-- Macro NAME & possible SHORTCUT -->
                          <Action type="3" message="1700" wParam="0" lParam="0" sParam="" />                <!-- Initialization S/R             -->
                          <Action type="3" message="1601" wParam="0" lParam="0" sParam='&quot;&quot;' />    <!-- SEARCH ""                      -->
                          <Action type="3" message="1625" wParam="0" lParam="0" sParam="" />                <!-- NORMAL search mode             -->
                          <Action type="3" message="1602" wParam="0" lParam="0" sParam='&quot;' />          <!-- REPLACE "                      -->
                          <Action type="3" message="1702" wParam="0" lParam="768" sParam="" />              <!-- or 512, if NO Wrap-around      -->
                          <Action type="3" message="1701" wParam="0" lParam="1609" sParam="" />             <!-- Replace All, in CURRENT file   -->
                      </Macro>
              

              Best Regards,

              guy038

              1 Reply Last reply Reply Quote 2

              Hello! It looks like you're interested in this conversation, but you don't have an account yet.

              Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

              With your input, this post could be even better 💗

              Register Login
              • First post
                Last post
              The Community of users of the Notepad++ text editor.
              Powered by NodeBB | Contributors