Jump to content

how build a interactive script by command line


Recommended Posts

Greetings,

How build a script interactive by command line...
In prompt MS-DOS, you type: host.exe (this is a AutoIt script compiled), and they show:

Something like this...

C:\host.exe<ENTER>
host> Greeting, what is your name?   
host< Luigi<ENTER>
host> Hi "Luigi"
host< exit<ENTER>
host> bye
C:\


Best regards.
 

Edited by Luigi

Visit my repository

Link to comment
Share on other sites

@FrancescoDiMuro Thank you!

 

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Compression=4
#AutoIt3Wrapper_UseUpx=y
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include-once
#include <Array.au3>

Global $self = "Jarvis"

Global $read
Global $name = 0

Say($self, "Greetings!")
Say($self, "Whats your name?")

While Sleep(10)
    $read = ConsoleRead()
    If @extended Then
        $read = StringRegExpReplace($read, "[\r\n]", "")
        If $name Then
            Say("You", $read)
        Else
            $name = $read
            Say($self, "Hello " & $name & "!")
        EndIf

        If StringInStr($read, "exit") Then
            Say($self, "bye bye")
            Exit
        EndIf
        $read = ""
    EndIf
WEnd

Func Say($who, $var)
    ConsoleWrite($who & " say: " & $var & @CRLF)
EndFunc

 

Edited by Luigi

Visit my repository

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