Auto Highlight and copy to clipboard using mouse wheel.



  • Hello, I’m a new user asking help with notepad++
    I have a paragraph in notepad++, I want to be able to use the mousewheel to be able to auto highlight a line in the paragraph and copy it to the clipboard instead of the default scroll bar movement.

    whenever I scroll up, the mouse wheel will auto highlight the line that is currently above, likewise if i scroll the mousewheel down, it will auto highlight
    the line below, also upon highlighting the line, I want it to be copied to the clipboard in windows 10.

    Can anyone recommend a method on how to do this?



  • welcome to the notepad++ community, @cedr777

    i’m not sure i understand how and why you want to use the scroll wheel to copy a line to the clipboard.

    but the usual way to copy a whole line to the clipboard, is to:

    • triple-click on any place of a line. (this will highlight the whole line)
    • press [ctrl]+[c]to copy the line into the clipboard.

    if you want to copy more than one non consecutive line to your clipboard at once:

    • first go to settings > preferences > editing and make sure multi editing is enabled.
    • go back to your document.
    • hold [ctrl] and triple-click on all lines you need.
      (this will highlight only your required lines, even if there are other lines in between)
    • press [ctrl]+[c]to copy the line into the clipboard.
      (the clipboard will now contain all selected lines in the order you have selected them, which is useful if you need a different order than the original document)


  • @cedr777

    here’s a screencast, to show the selective multi-line clipboard reordering in action, if this function is of interest to you:

    Imgur



  • @Meta-Chuh

    Nice one. I never thought about the ordering of a copied multi-select. (Of course, if pasting back into a different N++ tab it is very easy to reorder manually)

    <OT> If only Windows Explorer would remember the correct order of ctrl+clicked items. I use Beyond Compare a lot and always have to remember to check which side of the diff is which before doing what I’m there to do. :( Mac OS has no such problem; running BC there it ALWAYS gets the ordering correct. :) </OT>



  • Thank you for the reply guys, but I ended up using this AutoHotkey script to make it work:

    F1::Send {Up}{HOME}+{END}^c{END}
    F2::Send {Down}{HOME}+{END}^c{END}

    Although it doesn’t specify the use of the mouse wheel as I originally hoped for, it instead uses F keys.
    Whenever you push F1, it will auto highlight the entire line that is currently above the cursor and copy it to the clipboard.
    and whenever you push F2, it will auto highlight the entire line beneath the cursor and copy it to the clipboard.

    I’m actually using this to read a Japanese novel pasted in notepad++ together with a translation software called Translation Aggregator for automatic translation purposes.

    I’m just wondering if there’s a way to integrate the script inside notepad++ without relying on Autohotkey.



  • @cedr777 said:

    I’m just wondering if there’s a way to integrate the script inside notepad++ without relying on Autohotkey.

    Yes, there is. Notepad++ has some scripting languages (e.g. Pythonscript, Luascript) that can do this. But they are not “inside”, they are plugins (add-ons). Whether you feel that they are “inside”-enough when compared to AutoHotkey (which is definitely an “outside” solution) is up to you.

    Clearly your solution is working for you, maybe don’t change it. I don’t think you will find a solution like you first described (using the mouse)…at least, not an easy one.



  • @cedr777

    isn’t your initial question covered by click(hold)+scroll?
    Of course only if you have something to scroll

    And concerning your autohotkey - looks like this can be recorded as a macro, couldn’t it?



  • @Ekopalypse said:

    looks like this can be recorded as a macro

    My suggestion for a script was based upon what I thought was the desire to not move the current caret while doing this operation. But if this is not truly the need, then yah I think a macro would do the job, although one may need to use other variants of “home” and “end” to move to the definitive start/end of lines. “Start” is problematic when there is leading whitespace, and “end” is troublesome when line-wrap is enabled.



  • @cedr777

    I’m just wondering if there’s a way to integrate the script inside notepad++ without relying on Autohotkey.

    yes, like @Ekopalypse mentioned, this can be done easily with the built in macro recorder.

    • go to macro > start recording
    • press all keys you want to press, exactly like if you do it manually, you can also use any menu you might need, they will be recorded too.
    • go to macro > stop recording
    • go to macro > save current recorded macro
    • give it a name and select which keyboard shortcut combination you would like to have for this macro


  • Thank you! I will give the macro recording a try as well.



  • The built in macro worked nicely! I think I will stick to it.


Log in to reply