 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Believer
Joined: 13 Jun 2008 Posts: 41 Location: Earth
|
Posted: Tue Mar 09, 2010 1:24 pm Post subject: Press and hold left mouse for 3 seconds - SOLVED! |
|
|
Not sure why this isn't working (or maybe it is and I've been fooling around with it so much I don't realize it anymore), and not really sure how to test it accurately, but all I am trying to do is have it hold down the left mouse for 3 seconds once it is pressed, then release it. Any thoughts?
| Code: |
#InstallMouseHook
#Persistent
*$LButton::
{
GoSub clicky
}
clicky:
{
MouseClick, left,,,1,0,D
Sleep 3000
MouseClick, left,,,1,0,U
}
Return
|
Thank you in advance!
Last edited by Believer on Thu Mar 11, 2010 4:07 pm; edited 1 time in total |
|
| Back to top |
|
 |
doyle
Joined: 14 Nov 2007 Posts: 325 Location: London, England
|
Posted: Tue Mar 09, 2010 2:58 pm Post subject: Re: Press and hold left mouse for 3 seconds |
|
|
| Code: |
#InstallMouseHook
#Persistent
*$LButton::
{
GoSub clicky
}
Return ; <<This?
clicky:
{
MouseClick, left,,,1,0,D
Sleep 3000
MouseClick, left,,,1,0,U
}
Return
|
|
|
| Back to top |
|
 |
Believer
Joined: 13 Jun 2008 Posts: 41 Location: Earth
|
Posted: Tue Mar 09, 2010 8:23 pm Post subject: |
|
|
Knew it was something silly...
Thanks! |
|
| Back to top |
|
 |
Believer
Joined: 13 Jun 2008 Posts: 41 Location: Earth
|
Posted: Wed Mar 10, 2010 12:15 am Post subject: Follow up question |
|
|
So that small sample works, but why does this one seem to lock-up (freeze) the left mouse button for 3 seconds rather than hold it down?
| Code: |
#InstallMouseHook
#Persistent
*$LButton::
{
GetKeyState, CapsState, CapsLock, T
If (CapsState = "D")
{
Loop
{
if not GetKeyState("LButton", "P")
{
Break
}
Else
{
GoSub clicky
}
}
}
Else
{
Click Down
}
Return
*LButton Up::Click up
}
Return
clicky:
{
MouseClick, left,,,1,0,D
Sleep 3000
MouseClick, left,,,1,0,U
}
Return
;------------------------------------------------
; Control + alt + q to exit application
;------------------------------------------------
^!q::
exitapp
Return
|
|
|
| Back to top |
|
 |
Believer
Joined: 13 Jun 2008 Posts: 41 Location: Earth
|
Posted: Thu Mar 11, 2010 4:06 pm Post subject: Solved! |
|
|
Thanks infoG!
| Code: |
#InstallMouseHook
#SingleInstance, Force
*$LButton::
BlockUp := True
If GetKeyState("CapsLock", "T")
Loop
if not GetKeyState("LButton", "P")
Break
else
GoSub clicky
Else
Click Down
BlockUp := False
Return
*LButton Up::
if !BlockUp
Click up
return
clicky:
Click Down
Sleep 3000
Click Up
Return
;------------------------------------------------
; Control + alt + q to exit application
;------------------------------------------------
^!q::
exitapp
|
|
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|