Jump to content

prevent key hold down...?


Recommended Posts

Hello,

I have a relatively simple question with I hope a relatively simple answer...how is it possible to prevent the user from pressing and holding down a key? In other words to allow only singular keystrokes at a time...for example (see code below) allowing the 'right arrow' key on the keyboard to be depressed so as to run the function but to ignore when the user holds the key down...? Thank you in advance...

HotKeySet("{RIGHT}", "right")
...
Func right()
if $Map_X >= -1280 Then
GUICtrlSetPos($TheMap, $Map_X - 10, $Map_Y)
$Map_X -= 10
EndIf
EndFunc ;==>right
Link to comment
Share on other sites

Look at _IsPressed() in the help document. You can use a loop to determine the threshold in which you want something to happen.

Certifications: A+, Network+, Security+, Linux+, LPIC-1, MCSA | Languages: AutoIt, C, SQL, .NETBooks: AutoIt v3: Your Quick Guide - $7.99 - O'Reilly Media - September 2007-------->[u]AutoIt v3 Development - newbie to g33k[/u] - Coming Soon - Fate Publishing - Spring 2013UDF Libraries: SkypeCOM UDF Library | ADUC Computers OU Cleanup | Find PixelChecksumExamples: Skype COM Examples - Skype4COMLib Examples converted from VBS to AutoIt
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...