Jump to content

HotKeySet in console app?


Recommended Posts

Hello, I'm having some troubles using hotkeyset() in a console window..

Is it my fault or is it just not possible?

(using the 'Console.au3' UDF here)

#include <Console.au3>
HotKeySet('{ESC}','stop')

Global $input

While True
Cout("Enter your name: ")
cin($input)
system("pause")
WEnd

Func stop()
exit
EndFunc

Thanks.

TheAutomator.
Link to comment
Share on other sites

MBALZESHARI,

Your while loop is preventing the HotKeySet from working AFAICT. Try using While 1, Select and Case in your loop instead of While True.

 

So you suggest I don't use "While True", ok.

This is the code then:

#include <Console.au3>
HotKeySet('{ESC}','stop')


Global $input


While 1
Cout("Enter your name: ")
cin($input)
system("pause")
WEnd


Func stop()
exit
EndFunc

I can't see how I can use "Select Case" in this little script and hotkeyset() works fine when I use it in other scripts

with a "While True" loop...

Thanks for the reply.

 

TheAutomator. 

Edited by TheAutomator
Link to comment
Share on other sites

It works, but can not seem to interrupt the console window, sorry, don't know why.

 

If you hit escape before enter, it does exit.

 

EDIT:

 

I think MBALZESHARI may have been a little sleepy when writing the reply :)

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

JohnOne,

I think MBALZESHARI may have been a little sleepy when writing the reply   :) 

 

 

maybe  ^_^ 

so hit escape before enter does exit. hmmm  :think: 

do you think I have to ask the writer of that udf himself or would that be against the forum rules you think?

TheAutomator. 

Edited by TheAutomator
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

×
×
  • Create New...