AutoHotkey Community

It is currently May 27th, 2012, 9:02 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 3 posts ] 
Author Message
 Post subject: Key press time out
PostPosted: August 11th, 2006, 3:28 pm 
Offline

Joined: May 25th, 2006, 7:25 pm
Posts: 11
Location: Toronto
Hello All,

What I would like to know is how to get a key press to time out.
As in you press and hold a key down while thinking, change your mind and release and so don't want it sent.

This part of a one hand keyboard project...final piece!

Thanks


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 4:41 pm 
Offline

Joined: March 2nd, 2004, 3:36 pm
Posts: 10720
Maybe something like the following (though it may be too primitive for your needs):
Code:
$Space::
KeyWait, Space, T0.2
if ErrorLevel  ; It timed out, so the key is still down.
   Send {Space}
return

If you plan to have a lot of such threads running concurrently, you should probably use SetTimer instead of KeyWait (otherwise there can be synchronization issues if many such keys are pressed and then released in a different order).


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: August 12th, 2006, 6:05 pm 
Offline

Joined: February 14th, 2005, 4:05 pm
Posts: 4710
Location: Boulder, CO
For lowercase letters the following is a very simple solution:
Code:
a::
b::
c::KeyWait %A_ThisHotKey%

a up::
b up::
c up::IfLess A_TimeSincePriorHotkey,500, Send % Chr(Asc(A_ThisHotKey))


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: Bing [Bot], BrandonHotkey, hyper_ and 69 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