60

Is there any application to mimic the "Select to Copy and Middle Click to Paste" behaviour in Windows? I was hoping to find an AutoHotkey script for this, but I couldn't. Maybe someone here could quickly hack one for this :).

1
  • 1
    I know it's kind of specific, but GVIM for Windows actually inserts the content of the normal clipboard when middle-clicked. I would really like more optional productivity features in Windows like the one you're asking for.
    – Mitja
    Commented Apr 10, 2017 at 9:24

5 Answers 5

24

Well, there's the True X-Mouse Gizmo, if that works in your Windows version (it's a bit dated).

4
  • Here I can use the expression it worked like charm! Commented Feb 16, 2018 at 10:03
  • 1
    It is unbelievable how this works fine after so many years
    – insign
    Commented Sep 13, 2019 at 1:41
  • 1
    Works under Win 10, it uses the main clipboard, but : you need to select all the way, a double-click on a word to select it won't copy it ; it kills middle-click to open in a new tab ; it pastes in the textbox which has the focus, not the one under your cursor (you need an extra click to give focus).
    – lolesque
    Commented Dec 3, 2020 at 21:19
  • double and triple click highlighting don't seem to work
    – Harley
    Commented Sep 10, 2022 at 4:49
30

If you're looking for an AutoHotkey script, this one should probably do!

Here's an implementation for copy on select. You can simply select some text and it is copied immediately without having to press ctrl+c.

Conveinent middle button paste is also provided, but with a twist. Middlebutton is useful in browsers, so there is a short time (configurable) while you can paste with the middle button after copy, before original middleclick functionality is restored.

Also, if you click with the right button it cancels middlebutton paste.

Since after selection you usually click with the left button to the place where you want to paste, so that you put the focus there, it is done automatically when using middlebutton pasting.

clipx integration is also added to Ctrl+middlebutton.

I've been using the script for a few days and it's quite convenient. Sometimes the copy tooltip appears unwantedly when something is dragged, but it doesn't cause any problems.

4
  • This works great, especially if you only want copy on select. True X-Mouse Gizmo will make the middle click useless which is pretty annoying if you used to open new tab with middle click.
    – Terry Shi
    Commented Jan 31, 2011 at 3:14
  • 3
    the script has been updated later on: autohotkey.com/forum/… Commented Nov 16, 2011 at 11:40
  • Autohotkey is an awesome tool. Thanks for suggesting this.
    – Jus12
    Commented May 30, 2015 at 19:47
  • 1
    However good the mouse dragging idea sounds, I prefer just double-clicking the word to copy it. The reason I started looking for this sort of 'highlight-copy-paste' solution is that addons and extensions make my browser slower. So, I decided to find a desktop app. The Autocopy 2 on Firefox works exactly as I like: 1) double click the word and it gets automatically copied. 2) ctrl+v OR RMouse button + Paste. The solution with Autohotkey and the script seems good, however after that simple functionality in Firefox I understood what simple and easy means. Maybe, somebody could rewrite it? Commented Sep 19, 2017 at 17:03
13

Check out AutoClipX.

AutoClipX is a highly configurable program that automatically copies selected objects to the Windows clipboard like text, files and folders. Quickly paste what you have copied by clicking a mouse button! AutoClipX runs quietly in the system tray while you work as usual.

3
  • 4
    It helps to explain why this is a solution, rather than just linking to one.
    – zackrspv
    Commented Feb 1, 2012 at 22:10
  • 1
    Updated URL: autoclipx.informer.com/download Commented Jul 4, 2019 at 17:11
  • This works excellently - except you need to get the old freeware version 2.1.2.0 ( see filehippo.com/download_autoclipx newer ones are paywalled to an expired domain, so useless now) and create the missing folder it complains about when you install, and change the permissions on that folder to allow the program to write into it - then it works perfectly on windows 10+
    – cnd
    Commented Mar 31 at 11:23
2

Shallow copy on selection and shallow paste on middle click in Windows 11 (AutoHotkey script):

cos_mousedrag_treshold := 20 ; pixels
cos_copied_text := ""

#IfWinNotActive ahk_class ConsoleWindowClass

~lButton::
  MouseGetPos, cos_mousedrag_x, cos_mousedrag_y
  keywait lbutton
  mousegetpos, cos_mousedrag_x2, cos_mousedrag_y2
  if (abs(cos_mousedrag_x2 - cos_mousedrag_x) > cos_mousedrag_treshold
    or abs(cos_mousedrag_y2 - cos_mousedrag_y) > cos_mousedrag_treshold)
  {
    wingetclass cos_class, A
    if (cos_class == "Emacs")
      sendinput !w
    else {
      previous_clipboard := clipboard
      sendinput ^c
      sleep 50 ; wait for copied text to be stored in clipboard
      cos_copied_text := clipboard
      clipboard := previous_clipboard
    }
  }
  return

~mbutton::
  WinGetClass cos_class, A
  if (cos_class == "Emacs")
    SendInput ^y
  else {
    previous_clipboard := clipboard
    clipboard := cos_copied_text ; copy stored text to clipboard
    SendInput ^v
    sleep 50 ; I'm not sure if this is necessary
    clipboard := previous_clipboard
  }
  return

#IfWinNotActive

;; clipx
^mbutton::
  sendinput ^+{insert}
  return

This is a modified version of @Snark's answer, which in turn is taken from an anonymous post.

To use this AutoHotkey script, you need to have AutoHotkey installed on your computer. Once you've installed AutoHotkey, save this script as a .ahk file and then double-click the file to run it. The script will run in the background, you can see its icon on the right side of the taskbar.

2
  • Note that this script doesn't work with the latest AutoHotKey v2, so you need to install v1.1 or lower. Commented Jul 17, 2023 at 10:35
  • potentially might not work in Visual Studio Code with the vim editor - because ^c does not copy, and "sendinput ^c" looks like it needs that ? Maybe AHK has some other way to do a copy besides that?
    – cnd
    Commented Mar 31 at 11:38
-3
SetWinDelay,2
CoordMode,Mouse
return

~MButton::
sleep 100
    Send, ^v
return
~LButton:: 

MouseGetPos x0, y0
   Loop
   {
     Sleep 20
     GetKeyState keystate, LButton
     IfEqual keystate, U, {
       MouseGetPos x, y
       break
     }
   }
   if (x-x0 > 5 or x-x0 < -5 or y-y0 > 5 or y-y0 < -5)
   {                             
      Send ^c
   }


 if (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < DllCall("GetDoubleClickTime"))            
      Send ^c

 if (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < DllCall("GetDoubleClickTime"))
 doubleclick := true

return

#If doubleclick
  ~LButton::
  doubleclick := false
  if (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < DllCall("GetDoubleClickTime"))
  {
      Send, ^c
  }
  return

1
  • 2
    Welcome to Super User! Generally, answers are much more helpful if they include an explanation of what the code is intended to do, and why that solves the problem without introducing others.
    – MMM
    Commented Feb 14, 2020 at 15:00

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .