Jump to content
Sign in to follow this  
corl455

Question about HotKeySet

Recommended Posts

corl455

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.

Share this post


Link to post
Share on other sites
somdcomputerguy

I'm pretty sure that HotKeySet can only be used to call a function. But try it and see..


- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Share this post


Link to post
Share on other sites
CodyBarrett

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

Share this post


Link to post
Share on other sites
corl455

Dang, I was hoping for a shortcut =P. Oh well, I guess I'll keep making functions =)

Share this post


Link to post
Share on other sites
CodyBarrett

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...

Share this post


Link to post
Share on other sites
corl455

Well, I'm not actually going to have 261 functions, probably only around 40 or so, there isn't 261 keys on a keyboard =P

Share this post


Link to post
Share on other sites
omikron48

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.

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  

×