09-24-2007, 11:41 PM
int timefirstclick=GetTickCount
wait 0.4 KF u
err
,mes "single click"
int timesecondclick=GetTickCount
int timediff=timesecondclick-timefirstclick
out timediff
if(timediff<400)
,mes "double click"
,ret
The funny thing about this is that I was at first having trouble with the syntax for the trigger
In this case the letter "u"
U is alright as a test trigger but shouldn't work in real usage because you often have to type it for real! The extra keys on mice are usually some Ctrl-key or Alt-key combination like Ctrl-U.
As far as I know, you can't use a combination in the wait statement -
Doesn't work to indicate that you should wait until the combination Ctrl-U is lifted.
but if there is a way, I would love to know!
Anyway, I set the trigger to this to be Ctrl-U in QM - and set the side-mouse button (4) to be Ctrl-U using it's assignment program (Microsoft Intellimouse).
Anyway, the funny thing is that it worked!
The second "u", even though it was being sent along with a Ctrl key (from the mouse assignment), still was enough to set off the wait statement and therefore differentiate indicate a double click...
Amazing.
Let me know if this will be robust (am I missing the fatal flaw?) but it seems to be working.
Stuart
ps. this is exciting because it should allow triple clicks as well
Here goes:
int timefirstclick=GetTickCount
wait 0.4 KF u
err
,mes "single click"
,ret
int timesecondclick=GetTickCount
wait 0.4 KF u
err
,mes "double click"
,ret
int timethirdclick=GetTickCount
int timediff=timesecondclick-timefirstclick
int timediff2=timethirdclick-timefirstclick
;out timediff
if(timediff<800)
,mes "triple click"
,ret