Jump to content

Recommended Posts

Posted

Hi,

I'm afraid I'm just stupid or blind or both: how can I read user input from an AutoIt console program? Just a simple String input, terminated with pressing "Return"? 

This can't be difficult, but I can't find a solution. :(

  • 2 years later...
Posted

func Prompt($msg = "")
    Local $sResult
    Local $sText
    if not $msg = "" then ConsoleWrite ($msg & ": ")
    While True
        $sText = ConsoleRead()
        If @error Then ExitLoop
        if StringRight($sText, 1) = @LF then
            $sResult &= $sText
            ExitLoop
        EndIf
        Sleep(20)
    WEnd
    return $sResult
EndFunc

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