Jump to content

Get text from command prompt window


Recommended Posts

I need to run a program from the command prompt, and the program will ask the user for inputs. For example:

do you want to ... (y/n)

do you want to ... (y/n)

do you want to turn autoit on (y/n)

do you want to ... (y/n)

If I want to select yes on the 3rd option and no on the others, how can i grab the text "turn autoit on" from cmd so I can give the right answer.

(The number of questions may differ so I cant just send - n, n, y, n)

AutoIt Window Info cant seem to detect text off the cmd window :whistle:

Link to comment
Share on other sites

You need to use StdinWrite and StdOutRead, need Beta.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

A small example of using StdOutRead

; Use additional flag to use StdOut
$pid = Run(@ComSpec & ' /c help', '', @SW_HIDE, 2)

; Variable to store StdOut
$data = ''

While 1
    ; Get StdOut
    $data &= StdOutRead($pid)
    ; Exit the loop when StdOut is finished
    If @error Then ExitLoop
WEnd
    
; Show StdOut   
MsgBox(0, 'CMD Help commands', $data)
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...