Community
    • Login

    Automatically apply style token when highlighting text?

    Scheduled Pinned Locked Moved General Discussion
    8 Posts 2 Posters 2.2k 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.
    • M
      mclyburn5
      last edited by

      I use notepad++ when copying from configuration files to apply to network equipment. The issue is, sometimes sections get left off and there’s no way to tell if it’s been copied or not. Is there a way to setup notepad++ to automatically apply a style token each time text is highlighted/copied?

      Alan KilbornA 1 Reply Last reply Reply Quote 1
      • Alan KilbornA
        Alan Kilborn @mclyburn5
        last edited by Alan Kilborn

        @mclyburn5

        That’s an intriguing idea. It is nothing that Notepad++ can do natively, but if you’re willing to use the PythonScript plugin, I’ll volunteer to write a script that can do it for you – there’s not much to it.

        EDIT: Hmmm, maybe even a macro could do it…

        1 Reply Last reply Reply Quote 0
        • Alan KilbornA
          Alan Kilborn
          last edited by

          Yep, a macro can do it. Steps to set it up:

          • Start with some selected text
          • Start macro recording (see Macro menu)
          • Go to the Search menu, and pick your style choice from the Mark All submenu
          • Press Ctrl+c
          • Stop macro recording (see Macro menu)
          • Save the macro (see Macro menu) with a name
          • Assign the macro to a keycombo (see Settings menu then Shortcut Mapper…)

          Now, anytime you want to do the action, after selecting some text, run the macro via the keycombo to both stylize the text and copy it to the clipboard.

          1 Reply Last reply Reply Quote 2
          • M
            mclyburn5
            last edited by

            Hey they works great! Is there a easy way to share this macro with other team members?

            Alan KilbornA 1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn @mclyburn5
              last edited by

              @mclyburn5

              Not super easy, but it is stored in shortcuts.xml file so you could textually copy out of there.

              But…why not just share the short instruction list on how to set it up. That by far is the easiest unless we’re talking about dozens/hundreds/thousands of users.

              M 1 Reply Last reply Reply Quote 2
              • M
                mclyburn5 @Alan Kilborn
                last edited by

                @Alan-Kilborn Yeah the issue is a lot of the folks I’d be sharing it with aren’t the most technically savvy. They basically just copy/paste all day. I’d like to be able to just send a file that they can load themselves and be done with it.

                Alan KilbornA 1 Reply Last reply Reply Quote 1
                • Alan KilbornA
                  Alan Kilborn @mclyburn5
                  last edited by Alan Kilborn

                  @mclyburn5

                  Well, I understand, but unfortunately the shortcuts.xml file contains more than just what you created with the instructions above. You could distribute it, but if anyone you distributed it to had customized Notepad++ as far as keycombos or other macros goes, it would blow away such setups.

                  But if you still think it is OK, then you need to:

                  • shut down your Notepad++ (to get shortcuts.xml to be saved)
                  • locate that file (perhaps most likely found in the APPDATA area, but this is not a 100% certainty)
                  • distribute that file to the others
                  • have others exit their Notepad++
                  • copy the file to the correct place (again, likely “APPDATA”)

                  So to me, THAT may be more complicated than just the macro recording thing I discussed earlier. But, it is your choice.

                  1 Reply Last reply Reply Quote 2
                  • Alan KilbornA
                    Alan Kilborn
                    last edited by Alan Kilborn

                    Another method is to copy only the lines pertaining to the macro out of your shortcuts.xml and have your users put those same lines in theirs. I neglected to mention this, because, for unsophisticated users, this is probably the MOST complicated and error-prone approach.

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