..Reading through all 7 pages of this thread I found this code to work pretty good for me. I only need to have this work in one db program where I pull member ID data from & paste it into multiple other search db windows. I might also later wish to lock this down to work in maybe a small group of programs not just 1 or everyone, but I will have to figure that out 1st. Thank you Laszlo.
Here is a simplified version of the mouse handling. It gets the current double click time from the system and defines the left mouse button as a hotkey, not disturbing its original function.
When the hotkey is activated it checks if it was a double click. If yes, it waits a little to let the application mark the selection and sends Ctrl-C to copy it to the ClipBoard. If the click was not a double click, the subroutine waits until the mouse button is released. If in the mean time the mouse pointer was moved, some selection took place, so we can send Ctrl-C in this case, too. The selection is faster in this case, you may not even need Sleep.
Code:
DClickT := DllCall("GetDoubleClickTime") ; the system's double click time
~LButton::
If (A_PriorHotKey = A_ThisHotKey && A_TimeSincePriorHotKey <= DClickT) { ; Double click
;MouseGetPos X, Y, WinID, Ctrl ; and test if the click is in the desired window and its client area
Sleep 150 ; Highlighting needs time. Tune it to your app
Send ^c
Return
}
MouseGetPos X0, Y0 ; Store starting mouse position
KeyWait LButton ; Wait until mouse button is released
MouseGetPos X, Y
If (Abs(X-X0)+Abs(Y-Y0) < 5) ; If not moved: nothing is selected
Return
Sleep 10 ; Tune it to your app
Send ^c
Return
This is a very simple script. It does not check if something meaningful was actually selected, but still it works quite reliably. Try it and post your findings.