Sign in to follow this  
Followers 0
Cor

I want to run a function if only the numbers 1 to 24 are pressed on the keyboard.

5 posts in this topic

#1 ·  Posted (edited)

sorry posted twice

I want to run a function if only the numbers 1 to 24 are pressed on the keyboard.

Tried Hotkey but could only accept single numbers

I searched but cannot find a way to do this.

Needed for guitar TAB Notation input

thanks

grCor

Edited by Cor

gr.Corhttp://www.ready4music.com35+ programs for ...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should give you a general idea of how to do that.

Global $Buffer
For $X = 0 To 9
    HotKeySet($X, "KeyHandler")
Next

While 1
    Sleep(100)
WEnd


Func KeyHandler()
    $Buffer &= @HotKeyPressed
    If StringLen($Buffer) = 3 Then
        $Buffer = @HotKeyPressed
        Return
    EndIf
    If StringLen($Buffer) <> 2 Then Return
    If $Buffer >= 1 And $Buffer <= 24 Then MsgBox(0, "Event", $Buffer)
EndFunc   ;==>KeyHandler

If you type any number between 1 and 24 it should fire off a msgbox. It should be noted that to type single digit numbers they need to be prefixed with a zero , eg. "01"

Edited by SolidSnake

HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code.

Share this post


Link to post
Share on other sites

When you do you can provide ....

Very nice Uten!

Share this post


Link to post
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
Sign in to follow this  
Followers 0