uteotw Posted December 2, 2006 Posted December 2, 2006 (edited) I understand how to use StdinWrite() and StdoutRead() but I don't want to close the DOS Prompt. When I do $PID = Run(@ComSpec, @SystemDir, @SW_SHOW)oÝ÷ Ù8^¦º&¦Û-k+(¥éÞu»Â§!ÚºÚ"µÍÌÍÔQH[ÛÛTÜXËÞÝ[QÕ×ÔÒÕË ÌÍÔÕSÐÒS È ÌÍÔÕÕUÐÒS The prompt gets closed, but I'd like to keep it opened. Is there a way? thanks Edited December 2, 2006 by uteotw
piccaso Posted December 2, 2006 Posted December 2, 2006 You dont realy want to pipe stuff into the interpreter right? What are you trying to do? CoProc Multi Process Helper libraryTrashBin.nfshost.com store your AutoIt related files here!AutoIt User Map
MHz Posted December 2, 2006 Posted December 2, 2006 I understand how to use StdinWrite() and StdoutRead() but I don't want to close the DOS Prompt.If the script remains connected to the child process then it seems OK. If your script ends, then so does the child process. This example works OK. #include <Constants.au3> Global $data, $title, $pid $pid = Run(@ComSpec, @SystemDir, @SW_SHOW, $STDIN_CHILD + $STDOUT_CHILD) If ProcessWait($pid, 5) Then _StdIn('help /?') _StdIn('copy /?') _StdIn('exit') ProcessWaitClose($pid) EndIf Exit Func _StdIn($input) If Not ProcessExists($pid) Then Return $title = $input StdinWrite($pid, $input & @CRLF) If Not @error Then Sleep(100) _StdOut($data) EndIf EndFunc Func _StdOut(ByRef $output) If Not ProcessExists($pid) Then Return $output = StdOutRead($pid, 65500, True) Sleep(100) MsgBox(0x40000, $title, $data) EndFunc
thijzzz Posted December 5, 2006 Posted December 5, 2006 cool! Really, i needed this for some time. and my answer: remove the _StdIn('exit') from the example... ;-)
MHz Posted December 6, 2006 Posted December 6, 2006 cool!Really, i needed this for some time.and my answer: remove the _StdIn('exit') from the example... ;-)Glad to help.You do notice that _StdIn('exit') does exit the prompt, else how is it going to close? So it is needed at some point to politely close the prompt. Other examples on the forum may show @comSpec being used in command line mode by using the /c switch which will auto close the prompt.
uteotw Posted December 13, 2006 Author Posted December 13, 2006 I get it to work the way I want now. Thanks for all for your help.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now