Jump to content

Problem with HotKeySet


Khryus
 Share

Recommended Posts

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

 

Link to comment
Share on other sites

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 by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

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.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...