Community
    • Login

    Copying highlighted text lines from 1 Notepad++ file to another

    Scheduled Pinned Locked Moved Help wanted · · · – – – · · ·
    22 Posts 5 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.
    • guy038G
      guy038
      last edited by

      Hello, @george-rogers, @alan-kilborn, @peterjones and All,

      Alan, just tried this two scripts and, indeed, it fully copy/pastes the 5 style tokens, as well as the mark style and the Incremental search style ;-)) Well done ! We even have a 2nd clipboard as a bonus !

      However, I don’t see the immediate benefit for @george-rogers as, obviously, all these highlightings are lost for, both, the original and the copied file, once, you start Notepad++, again !


      Alan, I can see that your “status” as a Python script writer, monopolizes most of your time. But, maybe, you can find a few minutes to devote to the proposals I’ve made to you about this other Python script :

      https://community.notepad-plus-plus.org/post/54357

      Many thanks in advance !

      Best Regards,

      guy038

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

        @guy038 said in Copying highlighted text lines from 1 Notepad++ file to another:

        However, I don’t see the immediate benefit for @george-rogers as, obviously, all these highlightings are lost for, both, the original and the copied file, once, you start Notepad++, again !

        True. I’m working on a “solution” to this as well, see HERE.

        Alan, I can see that your “status” as a Python script writer, monopolizes most of your time. But, maybe, you can find a few minutes to devote to the proposals I’ve made to you about this other Python script : https://community.notepad-plus-plus.org/post/54357

        Yes, I’m working on this one as well.
        My in-progress version got a big, well, shall we say, “bigger” (more features) than first intended!
        I really need to exercise “scope control”. :-)
        Keep an eye on the thread of that posting in the coming days (weeks?).

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

          @Alan-Kilborn said in Copying highlighted text lines from 1 Notepad++ file to another:

          Keep an eye on the thread of that posting in the coming days (weeks?).

          But note that I’ll probably work to finish the “style save” script FIRST (sorry).
          I try (somewhat unsuccessfully) to pipeline things in FIFO order, without getting “too many” things going at once.

          Alan, I can see that your “status” as a Python script writer, monopolizes most of your time

          Never saw that as a “status” LOL.
          And my general rule is that I don’t take on script-writing for things that I wouldn’t personally use, or possibly for things I wouldn’t use but have some other interesting (to me) aspect.

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

            @guy038 said in Copying highlighted text lines from 1 Notepad++ file to another:

            fully copy/pastes the 5 style tokens, as well as the mark style and the Incremental search style

            Actually, the “incremental search style” isn’t handled by the provided scripts.
            The reason is that it is too “dynamic”.
            The other styles have more “permanence” to them.

            One could certainly add it to the list in the “copy-special” script code, though (no need for it to be in the “paste-special” code). Here are the details about it from the N++ source:

            #define SCE_UNIVERSAL_FOUND_STYLE_INC 28

            George RogersG 1 Reply Last reply Reply Quote 2
            • George RogersG
              George Rogers @Alan Kilborn
              last edited by

              Your time and efforts are Much Appreciated! I am admittedly a Notepad++ newbie when it comes to scripts and customization. Maybe you can point me to a YouTube video or video screenshare which shows me how to integrate these scripts. Thanks Again!

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

                @George-Rogers

                Someday we’ll turn the generic procedure into a FAQ.

                Steps:

                • Use Plugins admin to install the PythonScript plugin
                • Menu to Plugins > Python Script > New Script
                • Provide a (file) name for the script; you don’t need to specify an extension – .py will be added automatically
                • Press the Save button to close out the Save As dialog box.
                • At this point your script file will be showing and is empty; copying and pasting one of the scripts from above seems like a fine idea :-)
                • Save the file
                • To execute your script, menu to Plugins > Python Script >Scripts > (pick the name of your script)

                If you can successfully get that far with it, we can explain to you how to bind a keycombo to it to execute the script that way (which is better than menuing for an often-used script).

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

                  Hi, @alan-kilborn and All,

                  when I did the test, I used the maximum number of styles and I didn’t notice that the incremental search style was not copied !

                  Cheers,

                  guy038

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

                    @guy038

                    Actually (thinking more about it), if you want the Incremental Search or even the Smart Highlighting color to be part of the copy/paste, upon pasting it will lose its temporal nature and becomes permanent! So that’s a way to get a few more colors with this technique!

                    Here’s the info for Smart Highlighting :

                    #define SCE_UNIVERSAL_FOUND_STYLE_SMART 29

                    And so, here’s a modification to a section of the “copy special” script to include these:

                    # the following names are from the N++ source code:
                    SCE_UNIVERSAL_FOUND_STYLE_EXT1  = 25  # Style #1
                    SCE_UNIVERSAL_FOUND_STYLE_EXT2  = 24  # Style #2
                    SCE_UNIVERSAL_FOUND_STYLE_EXT3  = 23  # Style #3
                    SCE_UNIVERSAL_FOUND_STYLE_EXT4  = 22  # Style #4
                    SCE_UNIVERSAL_FOUND_STYLE_EXT5  = 21  # Style #5
                    SCE_UNIVERSAL_FOUND_STYLE       = 31  # redmarking style
                    SCE_UNIVERSAL_FOUND_STYLE_INC   = 28  # incremental-search style
                    SCE_UNIVERSAL_FOUND_STYLE_SMART = 29  # smart-highlighting style
                    
                    indicator_list = [
                        SCE_UNIVERSAL_FOUND_STYLE_EXT1,
                        SCE_UNIVERSAL_FOUND_STYLE_EXT2,
                        SCE_UNIVERSAL_FOUND_STYLE_EXT3,
                        SCE_UNIVERSAL_FOUND_STYLE_EXT4,
                        SCE_UNIVERSAL_FOUND_STYLE_EXT5,
                        SCE_UNIVERSAL_FOUND_STYLE,
                        SCE_UNIVERSAL_FOUND_STYLE_INC,
                        SCE_UNIVERSAL_FOUND_STYLE_SMART,
                        ]
                    
                    1 Reply Last reply Reply Quote 3
                    • George RogersG
                      George Rogers
                      last edited by

                      So, I am having issues installing the Python Script plugin (N++ newbie)
                      My N++ version is V7.6.1 with 32-bit
                      N++ > Plugin Admin does not find Python Script at all

                      Followed the instructions here for installing the Python Script plugin
                      https://community.notepad-plus-plus.org/topic/17256/guide-how-to-install-the-pythonscript-plugin-on-notepad-7-6-3-7-6-4-and-above

                      Here is screenshots of my file setup:
                      https://www.screencast.com/t/27yUQwOE
                      https://www.screencast.com/t/i80RUZMCuOd2

                      Screenshot of N++ Plugin Admin
                      https://www.screencast.com/t/8RGSUO0rw

                      Please help me understand where I am going wrong

                      Much Appreciated
                      George

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

                        @George-Rogers said in Copying highlighted text lines from 1 Notepad++ file to another:

                        My N++ version is V7.6.1 with 32-bit

                        So I think around the time of v.7.6.1, Plugins Admin was going through some growing pains.
                        That may be causing the trouble.
                        Any issues with updating to v.7.8.6, say?
                        You can certainly stick with the 32-bit version if you want.

                        1 Reply Last reply Reply Quote 1
                        • George RogersG
                          George Rogers
                          last edited by

                          I can give that a shot
                          How would I unwind that update and revert back to V7.6.1 in case I needed to?

                          EkopalypseE 1 Reply Last reply Reply Quote 0
                          • EkopalypseE
                            Ekopalypse @George Rogers
                            last edited by

                            @George-Rogers

                            Personally I would download a zipped version as it can run
                            in parallel to an installed version.

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

                              @Alan-Kilborn said in Copying highlighted text lines from 1 Notepad++ file to another:

                              …how to bind a keycombo to it to execute the script that way (which is better than menuing for an often-used script).

                              Some instructions for that are found in THIS POSTING.

                              1 Reply Last reply Reply Quote 1
                              • PeterJonesP PeterJones referenced this topic on
                              • First post
                                Last post
                              The Community of users of the Notepad++ text editor.
                              Powered by NodeBB | Contributors