AutoHotkey Community

It is currently May 27th, 2012, 4:43 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: March 9th, 2010, 2:24 pm 
Offline

Joined: June 13th, 2008, 11:00 pm
Posts: 41
Location: Earth
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 March 11th, 2010, 5:07 pm, edited 1 time in total.

Report this post
Top
 Profile  
Reply with quote  
PostPosted: March 9th, 2010, 3:58 pm 
Offline

Joined: November 14th, 2007, 2:47 pm
Posts: 335
Location: London, England
Code:
#InstallMouseHook
#Persistent

*$LButton::
{
   GoSub clicky
}
Return ; <<This?

clicky:
{
   MouseClick, left,,,1,0,D
   Sleep 3000
   MouseClick, left,,,1,0,U
}
Return


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: March 9th, 2010, 9:23 pm 
Offline

Joined: June 13th, 2008, 11:00 pm
Posts: 41
Location: Earth
Knew it was something silly...
Thanks!


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Follow up question
PostPosted: March 10th, 2010, 1:15 am 
Offline

Joined: June 13th, 2008, 11:00 pm
Posts: 41
Location: Earth
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Solved!
PostPosted: March 11th, 2010, 5:06 pm 
Offline

Joined: June 13th, 2008, 11:00 pm
Posts: 41
Location: Earth
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



Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: 0x150||ISO, Bing [Bot], rbrtryn, Yahoo [Bot] and 67 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group