Sign in to follow this  
Followers 0
probedrone

Get text from command prompt window

4 posts in this topic

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:

Share this post


Link to post
Share on other sites



You need to use StdinWrite and StdOutRead, need Beta.



Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

Ive been looking around at stdoutread() but being an AutoIt newb I dont really understand how it works or how to use it. Any help would be great.

Share this post


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

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