ImOracle Posted July 5, 2015 Posted July 5, 2015 Hello everyone (once again ), Im creating a program that relies on using Hotkeys and i would like the user to choose which Hotkey should call which function.So i created a list with labels just like in some games where its display like this: walk forward - "W"walk backwards - "S" The hard part is, to make it work. I guess i could have a little GUI displayed which said "press a button" then you press the button and the function would be assigned to that pressed button. But i dont wanna make a whole list of "_IsPressed" calls (partially because i know that would look ugly, slow down the app, maybe not even work and so on).And yes, i know Melba, The answer to this Problem could be used as a "Keylogger" but i simply dont know any other way around it apart from a InputBox that would prompt the user to type in the corresponding KeyCode (_isPressed Codes). Thank you in advance Oracle
JohnOne Posted July 5, 2015 Posted July 5, 2015 $var = InputBox("HotFunc", "Enter a Letter") HotKeySet($var, "_HotFunc") While 3 Sleep(333) WEnd Func _HotFunc() MsgBox(0, "HotKey", @HotKeyPressed) EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ImOracle Posted July 5, 2015 Author Posted July 5, 2015 $var = InputBox("HotFunc", "Enter a Letter") HotKeySet($var, "_HotFunc") While 3 Sleep(333) WEnd Func _HotFunc() MsgBox(0, "HotKey", @HotKeyPressed) EndFunc That would be an options for the A-Z keys...But what about ALT, CTRL, DEL, INS, SHIFT, WIN, and so on...Guess they could just type it in...and i guess i thought to complicated once again...
JohnOne Posted July 5, 2015 Posted July 5, 2015 Like you said, any other way is a keylogger, so if that's what you need, you'll have to research how to make one elsewhere. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
ImOracle Posted July 5, 2015 Author Posted July 5, 2015 Yea i implemented it using the typing technique, replaced all the ALT,SHIFT,WIN,CTRL using StringReplace with the corresponding Chars (!, #, + and so on) and set the resulting Hotkey to a test function. if the Hotkeyset call would return 1 it was valid and actually saved, if not repeat the whole thing. Just for anyone else who might stumble upon this in a few years. But thanks for the suggestion.
JohnOne Posted July 5, 2015 Posted July 5, 2015 You should also take into consideration that some keys might already be consumed by other applications.I am not aware of a way to detect those keys. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Zedna Posted July 5, 2015 Posted July 5, 2015 Look here: Resources UDF ResourcesEx UDF AutoIt Forum Search
ImOracle Posted July 10, 2015 Author Posted July 10, 2015 Nice! I already knew about the HotKey UDF and thought about implementing it. But i didnt know there were the other ones aswell! That makes things much easier. Thanks Zedna
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