Jump to content

Recommended Posts

Posted

Alright, so I'm creating a small program that I'm going to use to annoy people around me in school, all it will do is make the motherboard beep when you press the keyboard, but I'm going to set it up like a piano so you can play songs. So to get it to play something I have to use:

HotKeySet ( "q", "beep261")

Func beep261()
    beep(261,100)
endfnc

Is there any way to change that so all I have to do is something like:

HotKeySet ( "q", beep(261,100))

Mabey another function or something? I'm kind of new to autoit, but not to scripting.

Posted

to annoy people? uhmmm... T_T

anyway...according to your code.. you will have over 260 functions.. and roughly 4 lines per function... and 200+ Hotkeysets...

200+200*4=1000 lines of code just for this simple project...there are a few other simpler ways to do it.. but hotkeyset probably would be the fastest way.. _ispressed will have to check individually for each key

Posted

you can use an algorithm to get the HEX value of a key.. and place it in a loop... would be kinda laggy.. but it WOULD cut down on a hundred or two lines... then maybe call a function with parameters instead of making a hundred other functions...

Posted

Well, you could use a keyboard hook and process the key message VKeys. That way, you only have a very long switch statement, but you have to remember to forward the messages you receive or the key messages will be trapped.

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
×
×
  • Create New...