| View previous topic :: View next topic |
| Author |
Message |
dakota77
Joined: 29 Apr 2008 Posts: 6
|
Posted: Thu May 22, 2008 11:11 am Post subject: Fire an action when left click is hold down for one second |
|
|
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 |
|
 |
Extreminador
Joined: 05 May 2008 Posts: 22
|
Posted: Thu May 22, 2008 11:55 am Post subject: |
|
|
| Check the GetKeyState help |
|
| Back to top |
|
 |
Krogdor
Joined: 18 Apr 2008 Posts: 1145 Location: The Interwebs
|
Posted: Thu May 22, 2008 11:43 pm Post subject: |
|
|
| 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 |
|
 |
|