Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Wait for mouse movement - any
#4
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!
 
Code:
Copy      Help
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)


Messages In This Thread
RE: Wait for mouse movement - any - by Kevin - 12-21-2019, 04:32 AM
RE: Wait for mouse movement - any - by InterestedNewbie - 12-23-2019, 01:35 AM
RE: Wait for mouse movement - any - by Gintaras - 12-23-2019, 06:19 PM
RE: Wait for mouse movement - any - by Gintaras - 12-23-2019, 09:08 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)