corl455 Posted October 10, 2009 Share Posted October 10, 2009 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. Link to comment Share on other sites More sharing options...
somdcomputerguy Posted October 10, 2009 Share Posted October 10, 2009 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. Link to comment Share on other sites More sharing options...
CodyBarrett Posted October 10, 2009 Share Posted October 10, 2009 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 [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
corl455 Posted October 10, 2009 Author Share Posted October 10, 2009 Dang, I was hoping for a shortcut =P. Oh well, I guess I'll keep making functions =) Link to comment Share on other sites More sharing options...
CodyBarrett Posted October 10, 2009 Share Posted October 10, 2009 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... [size="1"][font="Tahoma"][COMPLETED]-----[FAILED]-----[ONGOING]VolumeControl|Binary Converter|CPU Usage| Mouse Wrap |WinHide|Word Scrammbler|LOCKER|SCREEN FREEZE|Decisions Decisions|Version UDF|Recast Desktop Mask|TCP Multiclient EXAMPLE|BTCP|LANCR|UDP serverless|AIOCR|OECR|Recast Messenger|AU3C|Tik-Tak-Toe|Snakes & Ladders|BattleShips|TRON|SNAKE_____________________[u]I love the Helpfile it is my best friend.[/u][/font][/size] Link to comment Share on other sites More sharing options...
corl455 Posted October 10, 2009 Author Share Posted October 10, 2009 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 Link to comment Share on other sites More sharing options...
omikron48 Posted October 10, 2009 Share Posted October 10, 2009 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. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now