Jump to content

Recommended Posts

Posted

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

 

Posted

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.

Posted

@firefox, thanks, it works, except that the function is _HotKey_Assign. Thanks again :)

"The story of a blade is linked in Blood." 

―Yasuo

 

Posted

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

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