AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Detect time since last release of left button

 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
diesalher



Joined: 14 Apr 2009
Posts: 28

PostPosted: Fri Jun 05, 2009 7:41 pm    Post subject: Detect time since last release of left button Reply with quote

Hi, i've tried to do this, but i'm not finding a working solution

I need a script that do something when i release the left button of the mouse but only if some time passes without another click. Let me explain

I do a sequence of clicks

CLick CLick CLick CLick CLick CLick(fast clicks) when i finish the fast click sequence (more than x miliseconds without a click) send something

any advice?

Sorry for my english, not my main lang.
Back to top
View user's profile Send private message
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Fri Jun 05, 2009 8:17 pm    Post subject: Reply with quote

Check the "TimeSince" variables.
_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
diesalher



Joined: 14 Apr 2009
Posts: 28

PostPosted: Fri Jun 05, 2009 8:40 pm    Post subject: Reply with quote

%A_TimeSincePriorHotkey% detects how much time has passed since last click, but doesnt make the execution of an event x seconds since the last click, or at least i dont see how...i'm a bit newbie so maybe i'm wrong
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Jun 05, 2009 9:15 pm    Post subject: Reply with quote

Code:
~LButton Up::SetTimer, Wait, -1

Wait:
KeyWait, LButton, D T3
If ErrorLevel
 MsgBox, You have not pressed the LButton in 3 seconds.
 ;send something
return
Back to top
View user's profile Send private message Visit poster's website
diesalher



Joined: 14 Apr 2009
Posts: 28

PostPosted: Fri Jun 05, 2009 9:51 pm    Post subject: Reply with quote

Why does i need a timer?

This code has not the same behaviour?

Code:

~LButton Up::
KeyWait, LButton, D T3
If ErrorLevel
  MsgBox, You have not pressed the LButton in 3 seconds.
 ;send something
return
Back to top
View user's profile Send private message
jaco0646



Joined: 07 Oct 2006
Posts: 3113
Location: MN, USA

PostPosted: Fri Jun 05, 2009 10:52 pm    Post subject: Reply with quote

That should work fine for you. I was just trying to avoid the #MaxThreadsPerHotkey directive, so my example will respond to consecutive UP events. Since physically pressing the button always precedes an UP with a DOWN, your code is fine.
Back to top
View user's profile Send private message Visit poster's website
diesalher



Joined: 14 Apr 2009
Posts: 28

PostPosted: Sat Jun 06, 2009 1:20 am    Post subject: Reply with quote

Thanks, [learning mode on]
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group