Jump to content
Shaggi

Console.au3 UDF

Recommended Posts

can someone tell me, how can I change Cin to input a password? 

Normally the way to do it is to change the console mode to not print characters sent to cin.

I can't remember the exact settings required, but if you use my (still unreleased) console.au3 and _Console_SetMode, I seem to remember it being that you needed to unset $ENABLE_ECHO_INPUT. There is an example of removing flags from the mode if you look at the code for _Console_Pause.

The main issue, that I haven't been able to work around yet, is that programs using the above console.au3 won't work when run from SciTE. That limitation is pretty much the reason I haven't released it properly yet.

Share this post


Link to post
Share on other sites

Found this just yesterday, I've already implemented it into a project (Server of another app). I do have a problem though. Cin() blocks until something is sent to the console (Enter pressed). I am trying to use THIS AutoIt thread implementation to do the console stuff in a separate thread, and potentially separate client TCP stuff into threads as well, but it would be SO much easier just to allow Cin to return 0 if enter isn't pressed.

I have Cin in a loop where I'm doing a lot of other networking stuff, but you can't do that if Cin is blocking everything until a command is entered..

Edited by RepublicCommando
Forgot to link 'THIS' in text

Share this post


Link to post
Share on other sites
On 8/1/2016 at 10:04 PM, RepublicCommando said:

Found this just yesterday, I've already implemented it into a project (Server of another app). I do have a problem though. Cin() blocks until something is sent to the console (Enter pressed). I am trying to use THIS AutoIt thread implementation to do the console stuff in a separate thread, and potentially separate client TCP stuff into threads as well, but it would be SO much easier just to allow Cin to return 0 if enter isn't pressed.

I have Cin in a loop where I'm doing a lot of other networking stuff, but you can't do that if Cin is blocking everything until a command is entered..

 
 
 

Have you tried setting the Cin size parameter to 1? or getch()?

I have used this for advanced CUI stuff before as well.

Edited by Biatu

What is what? What is what.

Share this post


Link to post
Share on other sites

Is there a way to get this working when compiled as CUI?   It works great when compiled as GUI, but as CUI "cin" won't block, and instead seems to be seeing a constant stream of carriage returns.

 

Thanks!

Share this post


Link to post
Share on other sites
3 hours ago, Gabriel12345 said:

Is there a way to get this working when compiled as CUI?   It works great when compiled as GUI, but as CUI "cin" won't block, and instead seems to be seeing a constant stream of carriage returns.

 

Thanks!

Yeah, I had this issue too when writing one of my scripts.  My question is.....is there a particular reason the script has to be compiled as a CUI?  The UDF seems to be an alternative to compiling the script as a CUI, so I just left my script to run as a GUI, and then called "Cout" at the very beginning, and it accomplishes pretty much the same thing.

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

×
×
  • Create New...