Turn Double Right-Click Into A Quick Clipboard Paste Shortcut
Reader Nakul writes in with a useful script that quickly pastes content from the clipboard into any application with nothing more than a double-click of your right mouse button.
Using the script is easy enough—just double-click the right mouse button anywhere that you want to paste, and the script will simulate the Ctrl+V shortcut, so this should even work when you are pasting something other than just text.
To create this function for yourself, simply make a new AutoHotkey script, or add the following to your existing one:
;Double Right Click to paste
~RButton::
If (A_PriorHotKey = A_ThisHotKey and A_TimeSincePriorHotkey < 500)
{
Sleep 200 ; wait for right-click menu, fine tune for your PC
Send {Esc} ; close it
Send ^v ; or your double-right-click action here
}
Return
Thanks, Nakul!
For more, read about how you can copy and paste quicker using True X-Mouse Gizmo, how to paste using the middle mouse button in Firefox, or even how to copy and paste without switching between windows.
Double-Right Click to Paste [AutoHotkey Forum]
- Next Post: Tasks Graduates From Gmail Labs, Google Calendar Gets Labs »
- « Previous Post: Make A Cooling Neck Tie Or Scarf
Comments (AU Comments | US Comments)
Middle click for paste is something I always miss when not on linux machines.
Confuzius
To quote the guy from Robocop:
"I LIKE IT"
I do like it, however when I right click just once I get the dropdown menu and then it immediately pastes without clicking anything, but it seems to work, so thanks.. :)
While I used to be into scripting everything, I found it extremely annoying when I would be on another computer (or a server). If you’re left handed I can see how this would be far more useful, but for me personally it takes just as much time to double right click since I don’t even have to think about it.
copy, paste, select all, are basics that everyone should train themselves to use.
This is cool. I just made a similar one to do the copy on Shift-Double Right click.
Thanks for the tip.
robertrock
@turnersd: ooh, thanks. That got rid of the momentary flash of the right click menu :D
@Phoshi: Try this.
MButton::
ifwinactive ahk_class CabinetWClass
{
Send {RButton} {down} ^{enter}
}
else
send {MButton}
return
Great! Thanks...
That's quite awesome.
I just made a script by request from one of the comments to open a folder in a new window on middleclick, but I'm not happy with it.
MButton::
ifwinactive ahk_class CabinetWClass
{
Send {RButton} {down} {Down}{enter}
}
else
send {MButton}
return
Any suggestions on how to fine tune it? (The timings all seem to work out, keystrokes appear to carry on regardless)
The main issue is finding out if it's actually a folder, but I don't know if such a thing is even possible! EDIT: Additionally, on my PC, the second right click closes the right click menu anyway! :P EDIT: A change I've got in mine (which I've had bound to alt-control-middle for a while) is to send an LButton straight before. Pastes where you point :D
Interesting! I set up middle click to do this in AHK at work to make it consistent with the AutoCopy extension (whose FF 3.5 update added a serious bug, unfortunately), but I had been idly wondering about how to make AHK recognize things like the double right click. Thanks for the lead!
@Phoshi: Beauty! Make some use out of the middle button. Since you are using the middle button to paste, why not also use it to copy? One middle click = copy, double middle click = paste. win/middle = regular middle click.
I'll hack out something on AHK when I have a minute and post if anyone wants it.
GregH
I took this a step farther with a script that sends any click-and-drag selection to the clipboard, and uses the middle mouse button for pasting. This makes the mouse behave very much like it does in Linux.
It can easily be adapted to use a double-right-click for paste; just replace the last bit starting with "MButton" with Nakul's script.
If you don't want the clipboard contents to be converted to plain text, remove the "clipboard=%clipboard%" line.
-Charles
; Linux-like mouse behavoir
~LButton:: ; Make the left mouse button a hotkey, but allow it to function normally as well.
MouseGetPos, xA, yA
loop ; Begin a loop.
{
Sleep, 10 ; Wait 10 milliseconds.
GetKeyState, LButton_state, LButton, P ; Check on the status of the left mouse button.
if LButton_state = U ; If the left mouse button has been released.
{
MouseGetPos, xB, yB
Transform, xA, abs, %xA% ; Return the absolute value of xA.
Transform, xB, abs, %xB%
Transform, yA, abs, %yA%
Transform, yB, abs, %yB%
xDiff = 0
xDiff += %xA% ; Add xA to xDiff.
xDiff -= %xB% ; Subtract xA from xDiff.
Transform, xDiff, abs, %xDiff%
yDiff = 0
yDiff += %yA%
yDiff -= %yB%
Transform, yDiff, abs, %yDiff%
diffSum = 0
diffSum += %xDiff%
diffSum += %yDiff%
If diffSum > 10
{
Send, ^c ; Copy.
clipboard = %clipboard% ; Convert the cliboard contents to plain text.
}
break
}
}
return
MButton:: ; Make the middle mouse button a hotkey, and _don't_ allow it to function as normal.
send, ^v ; Paste
return
chaws
@Confuzius: MButton:: Send ^V
#MButton:: Send {MButton}
that#ll paste on middle mouse, and send a normal middle click on win&middle, just in case you need it.
@JeRrYFaR:
I'm having issues with it actually. If I right-click I get the dropdown and immediately after it pastes. Trying to right-click on another program doesn't work properly as the right-click menu pops up and disappears. I've tried playing with the time delay to no avail. :(
@robertrock: if you're pressing shift already, why not move your fingers a few inches and just press control+c instead?
nasaboy007
@GregH: If I used single middle to paste, I'd probably do that, but I open new tabs too much :P
Between Firefox+Autocopy and my Logitech mouse, middle-click pasting is never out of reach.
paintbox
Left click, then right click to copy =) ~LButton & RButton:: Click up left clipboard = ; Start off empty to allow ClipWait to detect when the text has arrived. Send ^c ClipWait ; Wait for the clipboard to contain text. Return
CarolDarnoldo