Khryus Posted September 2, 2012 Posted September 2, 2012 Hi there, I need help on realizing this script. I am making kind of like a command-line program, and I wanted users to be able to 'send' a command by typing it into an InputBox and then pressing enter instead of pressing a button. I thought of this: HotKeySet("{ENTER}", "readInput") Func readInput() Switch GUICtrlGetState($COMMANDLINE) ;$COMMANDLINE is the InputBox Case $GUI_FOCUS ConsoleWrite("Submitted while commandline is focused"&@CRLF) ConsoleWrite("Temporarily storing the command in a variable."&@CRLF) $command=GUICtrlRead($COMMANDLINE) Case Else ConsoleWrite("Commandline isn't focused"&@CRLF) EndSwitch EndFunc But HotKeySet kind of like, prevents the key being used from being used. For instance, if I were to use the key Q on HotKeySet, I wouldn't be able to type it, but it would call the function. How can I make it so that I can still type it? Or is there a better way to do this? "The story of a blade is linked in Blood." ―Yasuo
JohnOne Posted September 2, 2012 Posted September 2, 2012 (edited) How about a runnable reproducer? EDIT: It matters you see. if you have a button to perform the task, and it is the default button then the enter key will act as though the button were presses. Edited September 2, 2012 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
FireFox Posted September 2, 2012 Posted September 2, 2012 But HotKeySet kind of like, prevents the key being used from being used. For instance, if I were to use the key Q on HotKeySet, I wouldn't be able to type it, but it would call the function. How can I make it so that I can still type it? Or is there a better way to do this? Hi, Yes, take a look here : Here you go : #include "HotKey.au3" _HotKeyAssign(0x0D, "readInput", BitOR($HK_FLAG_NOBLOCKHOTKEY, $HK_FLAG_NOREPEAT, $HK_FLAG_NOOVERLAPCALL)) Br, FireFox.
Khryus Posted September 2, 2012 Author Posted September 2, 2012 @firefox, thanks, it works, except that the function is _HotKey_Assign. Thanks again "The story of a blade is linked in Blood." ―Yasuo
FireFox Posted September 2, 2012 Posted September 2, 2012 @firefox, thanks, it works, except that the function is _HotKey_Assign. Thanks again oh, I am using an old version of the UDF Br, FireFox.
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