One Click OR Two Clicks . . Closing a macro [Resolved]

Hints, tips and tricks for newbies

Moderators: JRL, Dorian (MJT support)

Post Reply
ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

One Click OR Two Clicks . . Closing a macro [Resolved]

Post by ABIVEN » Wed May 01, 2013 12:26 pm

Hello,

In a Macro , I differentiate one click and two clicks

Turns well first time. But , often , second time it is as if there was a remanence of the macro : the macro triggers before the click

Of course I can take care of it by pressing x
Image

I put it hereafter very simple as one click detect

What is wrong in closing the Macro ?

Regards



//Detect left mouse click

wait>0.5
Message>Test it! 1 Click
wait>0.3
let>a=1
let>t=1

Label>DéclicLoop
let>t=1+t

LibFunc>user32,GetAsyncKeyState,KeyState,1
wait>0.1

If>KeyState0
//
// a=a+1*
let>a=a+1
endif

if>a=2,Déclic1

Goto>DéclicLoop
wait>0.05

Label>Déclic1
Message>1 Click
wait>0.4
// gives approx "time" of click ; must of course wait for the click ! !
MessageModal>t
Exit>

*line to delete in a test ; the post writes it wrong
Last edited by ABIVEN on Wed May 01, 2013 3:37 pm, edited 1 time in total.

ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

One Click OR Two Clicks

Post by ABIVEN » Wed May 01, 2013 3:35 pm

.
.
Actually is needed between two tests a Lclick

Incorporated now in the Macro





//Detect left mouse click after the Message

//Blank Test
LClick
wait>0.1
LClick

wait>0.5
Message>Test it Now! 1 Click or 2 Clicks ?
wait>0.3

let>a=1
let>t=1



Label>DéclicLoop
let>t=1+t

LibFunc>user32,GetAsyncKeyState,KeyState,1
wait>0.1

If>KeyState0
wait>0.05
let>a=a+1
endif

if>{(%a% = 3) AND (%t% {(%a% = 2) AND (%t% >20)},Déclic1

Goto>DéclicLoop
wait>0.05

Label>Déclic1
Message>1 Click
wait>0.4
MessageModal>t
Goto>Fin

Label>Déclic2
Message>2 Clicks
wait>0.4
MessageModal>t
Label>Fin

Exit>

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts