Jump to content

consoleread problem win7


Recommended Posts

Hello,

i have a small issue with consoleread under win7.

The following code works under win10, but does not work under Win7 (it simply does not get the input, it is bufferd and displayed when i exit the script with control-c).

While 1
            $input = ConsoleRead()
            If $input <> "" Then
                ConsoleWrite("Debug: " & $input & @CRLF)
                $input = StringStripWS($input, 8)
                ExitLoop
            Else
                Sleep(250)
            EndIf
        WEnd

any idea what i am doing wrong here?

 

Link to comment
Share on other sites

i just want to read in a number like this:

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
ConsoleWrite("Please enter a Number (0-9)" & @CRLF)
While 1
    $input = ConsoleRead()
    If $input > 0 And $input < 9 Then
        ExitLoop
    Else
        Sleep(250)
    EndIf
WEnd
ConsoleWrite("You entered: " & $input & @CRLF)

(you need to compile it and run it in a command promt to see the output).

It looks like this when i run it on win10 (press enter after the number)

Quote

test.exe
Please enter a Number (0-9)
3
You entered: 3

This works fine on Win10 but not on Win7, i need to ctrl+C to exit the program und then the number i typed is written to the console...

Quote

test.exe
Please enter a Number (0-9)
^C
5
 

 

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

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...