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 

Press and hold left mouse for 3 seconds - SOLVED!

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



Joined: 13 Jun 2008
Posts: 41
Location: Earth

PostPosted: Tue Mar 09, 2010 1:24 pm    Post subject: Press and hold left mouse for 3 seconds - SOLVED! Reply with quote

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
View user's profile Send private message
doyle



Joined: 14 Nov 2007
Posts: 325
Location: London, England

PostPosted: Tue Mar 09, 2010 2:58 pm    Post subject: Re: Press and hold left mouse for 3 seconds Reply with quote

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
View user's profile Send private message Visit poster's website
Believer



Joined: 13 Jun 2008
Posts: 41
Location: Earth

PostPosted: Tue Mar 09, 2010 8:23 pm    Post subject: Reply with quote

Knew it was something silly...
Thanks!
Back to top
View user's profile Send private message
Believer



Joined: 13 Jun 2008
Posts: 41
Location: Earth

PostPosted: Wed Mar 10, 2010 12:15 am    Post subject: Follow up question Reply with quote

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
View user's profile Send private message
Believer



Joined: 13 Jun 2008
Posts: 41
Location: Earth

PostPosted: Thu Mar 11, 2010 4:06 pm    Post subject: Solved! Reply with quote

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
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