I have a fairly simple idea that I think AutoHotKey could help me with. Essentially, when I use ctrl-v to paste, I want it to transmit a second ctrl-v so that I paste twice. I've got several keybinds in my development environment set up to be double-strokes of various ctrl keypresses, so I'd also like to be able to extend the script to various other keys aside from ctrl-v, too. This is my first AutoHotKey script though and I'm having a hard time getting off the ground since there's a lot here to digest. Thanks!
In AutoHotkey, double-sending a key is pretty straightforward.
#IfWinActive ~^v::SendInput, ^v
A few additional items:
1) You can tailor which programs will receive a double-send or not by using
#IfWinActive and designating a window name, exe name, class, etc. for WinTitle
2) The tilde in the hotkey definition means that the script doesn't stop the original keystroke from going through. If you want full control over whether the original goes through or not, you could remove the tilde (which will block the original keystroke) and then send it twice yourself (or not at all, or whatever you might want to do without the original keystroke getting registered).
3) You can add a delay if needed by extending the function to more than just a single-line hotkey definition and using a
4) You can use the same code for multiple hotkeys using A_ThisHotkey.
5) You can also allow keystrokes with multiple modifiers using a * modifier if needed. This may not work exactly right with the example code below but just something to be aware of.
Example of above items 1-4:
; this will execute the code to send duplicate keystrokes ; for any of the hotkeys defined, in this case, a,b,c, or Ctrl+V #IfWinActive ahk_exe notepad.exe ~a:: ~b:: ~c:: ~^v:: Sleep 200 ; Possibly use or adjust for reliability if needed SendInput % SubStr(A_ThisHotkey, 2) ; Remove tilde and send duplicate keystrokes for whichever hotkey executed Return