12-23-2019, 01:35 AM
(This post was last modified: 12-23-2019, 02:09 PM by InterestedNewbie.)
Following the above suggestion I trimmed down the script as I only need mouse move and I commented out the "out" section. I added two seconds Wait and single Left Click instead as I want the script to automatically left click two seconds after moving the mouse. However, the code below doesn't work and crashes both QM as well as some other programs (Warning: thread of <open ":2841:">Test has been terminated. It was hung and could not be ended correctly. It is recommended to restart QM).
The problem is probably in either int k=wParam
or str what action ?
Any suggestions would be welcome!
The problem is probably in either int k=wParam
or str what action ?
Any suggestions would be welcome!
int hmouse=SetWindowsHookEx(WH_MOUSE_LL &sub.MouseProc _hinst 0)
opt waitmsg 1
wait -1
UnhookWindowsHookEx hmouse
#sub MouseProc
function nCode wParam MSLLHOOKSTRUCT*x
if(nCode!=HC_ACTION) goto gr
int k=wParam
str what action
sel k
,case WM_MOUSEMOVE what="move"
sel k
,case [WM_LBUTTONDOWN,WM_RBUTTONDOWN,WM_MBUTTONDOWN,WM_XBUTTONDOWN] action="pressed"
,case [WM_LBUTTONUP,WM_RBUTTONUP,WM_MBUTTONUP,WM_XBUTTONUP] action="released"
/out "mouse %s %s at %i %i" what action x.pt.x x.pt.y
2
lef
;gr
ret CallNextHookEx(0 nCode wParam x)