Jump to content

CUI Interface for use with CMD


Recommended Posts

I am trying to create a script that allows me to run and use it with CMD as the interface.

For example:

C:\>myscript

Enter PIN

: ****

Success

C:\>

This is the code I have so far...

#AutoIt3Wrapper_Change2CUI=y
ConsoleWrite("Enter PIN" & @CRLF & ":")

Local $input

While 1
$input &= ConsoleRead()
if StringInStr($input,@CRLF) <> 0 then ExitLoop
Wend

if $input = "1111" & @CRLF Then
ConsoleWrite("Success")
Else
ConsoleWrite("Failure")
ConsoleWrite($input)

EndIf

The problem is that after it writes Enter PIN: it will not accept input and gets stuck. After I close the script, all the input I typed shows up in cmd.

C:\>myscript

Enter PIN

:

;;;; get's stuck,closes script

C:\>1111

I want be able to run this script without opening another cmd window but I haven't been able to find relevant examples for creating a "console" application used through cmd.

Can anyone help me out?

Link to comment
Share on other sites

Since it hasn't been posted on the forum yet, you won't find mine: https://github.com/MattDiesel/au3-console

Example from _Console_Alloc: https://github.com/MattDiesel/au3-console/blob/master/Examples/_Console_Alloc.au3

This UDF is work in progress, but is pretty complete. Probably not the easiest to use as it is more of a direct wrapper over the windows api.

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