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 

Fire an action when left click is hold down for one second

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



Joined: 29 Apr 2008
Posts: 6

PostPosted: Thu May 22, 2008 11:11 am    Post subject: Fire an action when left click is hold down for one second Reply with quote

Hello,

I'm new to AutoHotkey. A fantastic tool !

What is the method to fire an action when left click is hold down for one second ?

I know how tu use a timer. But how can I evaluate if the left click is hold down ?

Thanks for your help.
Back to top
View user's profile Send private message
Extreminador



Joined: 05 May 2008
Posts: 22

PostPosted: Thu May 22, 2008 11:55 am    Post subject: Reply with quote

Check the GetKeyState help
Back to top
View user's profile Send private message
Krogdor



Joined: 18 Apr 2008
Posts: 1145
Location: The Interwebs

PostPosted: Thu May 22, 2008 11:43 pm    Post subject: Reply with quote

Code:
LButton::
Sleep, 1000
If !(GetKeyState("LButton", "P")
return
 ;add your actions here
return


This should work fine unless you happen to click your mouse exactly one second after the initial clicking, in which case it will still think you held it down.

There are better ways of doing this, but this is the simplest and should work almost all the time.
Back to top
View user's profile Send private message AIM Address
Display posts from previous:   
Post new topic   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