Jump to content
Sign in to follow this  
Luigi

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

Share this post


Link to post
Share on other sites

@Luigi
Compile your script as CUI and use Console* functions to interact with the user :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

Share this post


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

Share this post


Link to post
Share on other sites

@Luigi

Happy to have helped :)


Click here to see my signature:

Spoiler

Thoughts:

  • I will always thank you for the time you spent for me.
    I'm here to ask, and from your response, I'd like to learn.
    By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

/*--------------------------------------------------------------------------------------------------------------------------------------------------------------------------*/

ALWAYS GOOD TO READ:

 

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  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...