Sign in to follow this  
Followers 0
Allow2010

consoleread problem win7

4 posts in this topic

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?

 

Share this post


Link to post
Share on other sites



Hi.

What are you trying to achieve? I mean, what kind of input has to be processed for what pupose exactly?

 

Regards, Rudi.


Earth is flat, pigs can fly, and Nuclear Power is SAFE!

Share this post


Link to post
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
 

 

Share this post


Link to post
Share on other sites

any other ideas how i can read in input from the user in a console session?

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
Sign in to follow this  
Followers 0