Jump to content
Sign in to follow this  

Help with syntax for sending enter key to stream with StdinWrite

Recommended Posts


I know the following script is not right on the sending of the enter key, but I've reviewed the FAQS and done some Topeka-ing on this (for sample scripts and for the proper syntax). What I'm attempting to do is get the StdinWrite to load a stream that will in turn format a flash drive. The only response that is required after the format statement is pressing an Enter key in response to a command prompt "Press Enter when ready...", but I'm not having any luck with this-- the $data is empty in the MsgBox. Any suggestions?



Local $PID = Run("format " & $sf_fd_letter, @SystemDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD)
; Write string to STDIN
StdinWrite($PID, Send "{Enter}")
; Calling with no 2nd arg closes stream

; Read from child's STDOUT and show
Local $data
While True
    $data &= StdoutRead($PID)
    If @error Then ExitLoop
MsgBox(0, "Debug", $data)

Share this post

Link to post
Share on other sites

Better run it with all needed parameters :(

Look here: #524309

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post

Link to post
Share on other sites

Thanks, mate! :(

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