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 

Repeat question

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
aaa666
Guest





PostPosted: Mon Aug 08, 2005 10:45 pm    Post subject: Repeat question Reply with quote

I need to count the number of times I press down certain keys (among other things), so I wrote:

Code:
count:=0

~a::key()
~b::key()
~c::key()
;... and so on

key()
{
 global
;...some other code here...
 count:=count+1
 return
}


The only problem is that when I hold down a key to repeat it (which is a desirable functionality), the count is repeated as well (which is not desirable). How can I execute code only once when a key is pressed down, but still keep the repeat functionality?
Back to top
Litmus Red



Joined: 25 Jul 2005
Posts: 139
Location: Richmond, Virginia

PostPosted: Tue Aug 09, 2005 1:12 am    Post subject: Reply with quote

How about this?

Code:
count:=0

~a up::key()
~b up::key()
~c up::key()
;... and so on

key()
{
 global
;...some other code here...
 count:=count+1
 return
}
Back to top
View user's profile Send private message
Guest






PostPosted: Tue Aug 09, 2005 10:37 am    Post subject: Reply with quote

Very Happy I missed the obvious solution, thanks!
Back to top
Display posts from previous:   
Post new topic   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