Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Help with condition like "if" or "timer"



  • Please log in to reply
3 replies to this topic
69latrik
  • Members
  • 6 posts
  • Last active: Aug 23 2016 12:19 PM
  • Joined: 06 Aug 2015

Hi,

 

This is my script :

~Lbutton Up::
{
Sleep 175
Send -
}
return

I Want that script works only at the 2nd click if 2nd click is less than 3 second of the first click :

  • First click do nothing
  • 2nd click if its 3 second less than first click activate my script

 

I Thing the solution is something like Timer ?

 

 

 



Xtra
  • Members
  • 954 posts
  • Last active: Jul 23 2016 09:04 PM
  • Joined: 29 Sep 2013
✓  Best Answer
~Lbutton Up::

    cnt++                             ; counter
    if (cnt = 1)                      ; < 1st click
    {
	time := A_TickCount           ; <
	return
    }

    if ((A_TickCount - time) < 3000)  ; << 2nd click
    {
	Sleep 175                     ; <<
	Send -                        ; <<
    }
	
    cnt := 0                          ; << reset

return

A_TickCount

 

HTH
 



69latrik
  • Members
  • 6 posts
  • Last active: Aug 23 2016 12:19 PM
  • Joined: 06 Aug 2015

Ty !!

 

Just one problem :

 

When i click and wait more than 3 seconds, the macro does not reload :

 

Exemple :

 

Click

Wait 4 second

Click

Wait 1.5 second

Click : No Send -

 

I work one it !



69latrik
  • Members
  • 6 posts
  • Last active: Aug 23 2016 12:19 PM
  • Joined: 06 Aug 2015

Solved, Ty Xtra

~Lbutton Up::

    cnt++                             ; counter
    if (cnt = 1)                      ; < 1st click
    {
	time := A_TickCount           ; <
	return
    }

    if ((A_TickCount - time) > 2000)  ; << 2nd click
    {
	time := A_TickCount           ; <
	return
    }
	
    cnt := 0                          ; << reset


    if ((A_TickCount - time) < 2000)  ; << 2nd click
    {
	Sleep 100                     ; <<
	Send -                        ; <<
    }
	
    cnt := 0                          ; << reset



return