Sign in to follow this  
Followers 0
Khryus

Problem with HotKeySet

5 posts in this topic

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

 

Share this post


Link to post
Share on other sites



#2 ·  Posted (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 by JohnOne

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

Monkey's are, like, natures humans.

Share this post


Link to post
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.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

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


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

―Yasuo

 

Share this post


Link to post
Share on other sites

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


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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
Sign in to follow this  
Followers 0