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 

Wait 1 second

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



Joined: 09 Nov 2009
Posts: 92

PostPosted: Thu Feb 04, 2010 5:47 pm    Post subject: Wait 1 second Reply with quote

I need to press a key "b" and If I keep pressed the "b" key wait 2 seconds and only send 1 time the other "b" key.

So if I press "b" key for 5 seconds, I'll only obtain 3 "b" keys.
Back to top
View user's profile Send private message
complx



Joined: 22 Jan 2010
Posts: 34
Location: Germany

PostPosted: Thu Feb 04, 2010 7:40 pm    Post subject: Reply with quote

Something like this?
Code:
#singleInstance force

:*:b::
{
    KeyWait, b, T2
    sendInput b
}

Edit: ...or better this way?
Code:
#singleInstance force

:*:b::
{
    sendInput b
    KeyWait, b, T2   
}


HTH
_________________
complx

“Give a man a fish; you have fed him for today. Teach a man to fish; and you have fed him for a lifetime”—Author unknown
Back to top
View user's profile Send private message
answer4u
Guest





PostPosted: Thu Feb 04, 2010 10:41 pm    Post subject: Reply with quote

How about something like this?
Code:
$b::
   If key_down
      Send, b
   Else {
      key_down := True
      Sleep, 2000
   }
Return
   
b up:: key_down := False
Back to top
MasterFocus



Joined: 08 Apr 2009
Posts: 3035
Location: Rio de Janeiro - RJ - Brasil

PostPosted: Thu Feb 04, 2010 10:43 pm    Post subject: Reply with quote

Tested and working:
Code:
$b::
  Send, b
  KeyWait, b, T2
Return

_________________
"Read the manual. Read it again. Search the forum.
Try something before asking. Show what you've tried.
"

Antonio França
My stuff: Google Profile
Back to top
View user's profile Send private message Visit poster's website
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