Trong Posted May 11, 2015 Share Posted May 11, 2015 Local $sAnswer = InputBox(" ", "Write your name:", "", "", 404, 136, Default, Default, 120) MsgBox(0,"","Nice to meet you "&$sAnswer)How convert this code into a console?Print the question and wait for answers from the user in the console window that is not INPUT BOX? ConsoleWrite("Write your name:" &@CRLF) ConsoleWrite("Nice to meet you: " & $sAnswer &@CRLF) Regards, Link to comment Share on other sites More sharing options...
SadBunny Posted May 11, 2015 Share Posted May 11, 2015 Freely adapted from the helpfile of ConsoleRead. Notice that it should be ran as a compiled exe, and be compiled as a console application (otherwise ConsoleWrite will not write to the dos screen).Use the SciTE compile dialog (Ctrl+F7, check option Create CUI instead of GUI EXE ), or the /console switch to if you command the compiler from the commandline.Run by piping the standard input of the shell session (descriptor CON) to the command, by literally doing this: type CON | myapplication.exe (of course changing the application name to your own).#Region ;**** Directives created by AutoIt3Wrapper_GUI **** #AutoIt3Wrapper_Change2CUI=y #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI **** #include <MsgBoxConstants.au3> Example() Func Example() If Not @Compiled Then MsgBox($MB_SYSTEMMODAL, "", "This script must be compiled in order to run the example.") Exit EndIf ConsoleWrite("Enter your name. Enter ^Z on a new line when you're done (equals EOF)." & @CRLF & "Name: ") Local $sOutput While True $sOutput &= ConsoleRead() If @error Then ExitLoop Sleep(25) WEnd ; DOS only recognizes the EOF command when it's at the start of a line, meaning the last character is always a newline While StringRegExp(StringRight($sOutput, 1), "[\r\n]") $sOutput = StringTrimRight($sOutput, 1) WEnd ConsoleWrite("Name received: '" & $sOutput & "'") EndFunc ;==>Example Trong 1 Roses are FF0000, violets are 0000FF... All my base are belong to you. Link to comment Share on other sites More sharing options...
jvds Posted May 11, 2015 Share Posted May 11, 2015 I was looking around for color output in cmd and then i saw an example that fit your need in color xDthe first example on that topic Trong 1 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now