I am a big fan of AHK. Thanks to the creators and upkeepers.
I have a small piece of mouse-select-copy to clipboard code (kudo's to authors) which, instead of ^c produces c in about 25% of cases. I have tried Send, SendInput, {Ctrl down}c{Ctrl up} etc and nothing seems to solve the problem. My code:
Code: Select all
#singleinstance force
#UseHook
#InstallMouseHook
#IfWinNotActive ahk_class Net UI Tool Window
#IfWinNotActive ahk_class bosa_sdm_msword
~LButton::
MouseGetPos x0, y0 ; save start mouse position
KeyWait LButton
MouseGetPos x, y ; position when button released
If (abs(x-x0) > 10 or abs(y-y0) > 10) {
clip0 := ClipBoardAll ; save old clipboard
ClipBoard =
;SendInput {Ctrl down}c{Ctrl up} ; selection -> clipboard
Send,^c
ClipWait 2, 1 ; restore clipboard if no data
If ErrorLevel
ClipBoard := clip0
}
Return
#IfWinNotActive
br,
Kaido