Community
    • Login

    Macro of function to capitalize all words in selection

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    9 Posts 3 Posters 3.7k Views
    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.
    • Jim KolbJ
      Jim Kolb
      last edited by

      Is this even possible with Notepad++??

      Scott SumnerS 1 Reply Last reply Reply Quote 0
      • Scott SumnerS
        Scott Sumner @Jim Kolb
        last edited by

        @Jim-Kolb

        You could record the following Replace-All action in a macro.

        Open the Replace dialog (ctrl+h) and set up the following:

        Find-what zone: (\w)(\w+)
        Replace-with zone: \U\1\E\2
        Search mode: Regular expression
        In-selection checkbox: Ticked

        (…start macro recording here…)
        Action: Press the Replace All button
        (…end macro recording here…test/save/name/playback your macro…)

        Jim KolbJ 1 Reply Last reply Reply Quote 1
        • Claudia FrankC
          Claudia Frank
          last edited by

          Or maybe just Alt+U ? (Edit->Convert Case to->Proper Case)

          Cheers
          Claudia

          Jim KolbJ Scott SumnerS 2 Replies Last reply Reply Quote 2
          • Jim KolbJ
            Jim Kolb @Claudia Frank
            last edited by

            @Claudia-Frank

            What version is that in?

            Am I using Notepad++ v6.9.2
            and alt +U (Edit->Convert Case to->Proper Case) is not available.
            Only Upper and Lower cases are there.

            Claudia FrankC 1 Reply Last reply Reply Quote 1
            • Scott SumnerS
              Scott Sumner @Claudia Frank
              last edited by

              @Claudia-Frank

              Haha…yea, that’s the better option…must be that someone is making me think every problem is best solved with regex. :)

              1 Reply Last reply Reply Quote 2
              • Claudia FrankC
                Claudia Frank @Jim Kolb
                last edited by Claudia Frank

                @Jim-Kolb

                if I correctly researched then the commit was made on the 30 Jun 2016 which means
                the next version was 7.0.

                @Scott-Sumner
                Yes Scott, looked like you were in the regex mood :-D
                But don’t be afraid, happens to me also too often - trying to solve something
                with python script just to find out that it is builtin :-D

                Cheers
                Claudia

                Jim KolbJ 1 Reply Last reply Reply Quote 1
                • Jim KolbJ
                  Jim Kolb @Scott Sumner
                  last edited by

                  @Scott-Sumner
                  Will the macro remember the In-selection checkbox: Ticked?
                  I’d hate to re-run and have it replace everything :)

                  Scott SumnerS 1 Reply Last reply Reply Quote 0
                  • Scott SumnerS
                    Scott Sumner @Jim Kolb
                    last edited by

                    @Jim-Kolb

                    Well…I hope you didn’t ignore @Claudia-Frank 's suggestion because it is easier (and thus better) than my original solution. That being said, I have these comments:

                    Comment #1: With the regular expression replacement solution, the macro WILL remember the In selection setting. When you run the macro and you have nothing selected, nothing will happen.

                    Comment #2: With @Claudia-Frank 's solution, if there is nothing selected, the convert-case command will do nothing when run from a macro, and isn’t even selectable via the menus when using the command interactively.

                    Thus, neither way of doing it is like some other Notepad++ commands that run on the whole file if there is no active selection.

                    1 Reply Last reply Reply Quote 2
                    • Jim KolbJ
                      Jim Kolb @Claudia Frank
                      last edited by

                      @Claudia-Frank
                      Thanks for the info.
                      I updated Notepad++ to v7.5.1 and now I have lots of options! :)

                      Sorry it took so long to reply…
                      Have to wait 20 minutes between posts because I’m new with no reputation. :)

                      1 Reply Last reply Reply Quote 2
                      • First post
                        Last post
                      The Community of users of the Notepad++ text editor.
                      Powered by NodeBB | Contributors