59FIFTY Posted January 13, 2007 Share Posted January 13, 2007 Hi there, I have a little problem, I was trying to read the output of and autoit script from another script. I.e. Script A starts Script B and reads the output of Script B, but I dont know how to do it. I tried starting Script B over the console with Autoit3.exe /script but I cant write to the console from Script B Any suggestions? Link to comment Share on other sites More sharing options...
FuryCell Posted January 13, 2007 Share Posted January 13, 2007 (edited) Take a look at the Std*() functions in the helpfile. StdinWrite ( process_id[, string]) StdinWrite ( process_id[, string] ) StdoutRead ( process_id[, count[, peek = false]] ) Edited January 13, 2007 by SolidSnake HKTunes:Softpedia | GoogleCodeLyricToy:Softpedia | GoogleCodeRCTunes:Softpedia | GoogleCodeMichtaToolsProgrammer n. - An ingenious device that turns caffeine into code. Link to comment Share on other sites More sharing options...
59FIFTY Posted January 13, 2007 Author Share Posted January 13, 2007 scriptA.exe#include <Constants.au3> $file = @ScriptDir & "\scriptB.au3" If @Compiled = 1 Then $exeFile = FileGetShortName(@AutoItExe & ' /AutoIt3ExecuteScript "' & $file & '"') $PID = Run($exeFile, @ScriptDir, @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) Else $au3File = FileGetShortName($file) $PID = Run(@AutoItExe & " " & $au3File, "", @SW_HIDE, $STDIN_CHILD + $STDOUT_CHILD) EndIf While 1 $line = StdoutRead($PID) If @error = -1 Then ExitLoop If $line <> "" Then MsgBox(0, "STDOUT read:", $line) WendscriptB.au3MsgBox(0, "message from B", "Hi im scriptB.au3") $PID = ProcessExists("scriptA.exe") StdinWrite($PID, "hi from B through STDIN")It calls scriptB and scriptB displays the MessageBox, but the While loop with the StdoutRead doesnt get anything, why? Is it a problem with$PID = ProcessExists("scriptA.exe") Link to comment Share on other sites More sharing options...
59FIFTY Posted January 13, 2007 Author Share Posted January 13, 2007 no idea? Link to comment Share on other sites More sharing options...
59FIFTY Posted January 14, 2007 Author Share Posted January 14, 2007 It's still not working, and I'm a 99% sure its because of $PID = ProcessExists("scriptA.exe") Link to comment Share on other sites More sharing options...
Valuater Posted January 14, 2007 Share Posted January 14, 2007 It's still not working, and I'm a 99% sure its because of $PID = ProcessExists("scriptA.exe") me too... per help Reads in a number of characters from the STDOUT stream of a previously run child process. script "A" is not a child of script "B" 8) Link to comment Share on other sites More sharing options...
59FIFTY Posted January 14, 2007 Author Share Posted January 14, 2007 That's what I was guessing, no child, so it doesnt work, but somehow I have to output data into the regular STDOUT if a script. Ony question is how? There is no cout>> Link to comment Share on other sites More sharing options...
MHz Posted January 14, 2007 Share Posted January 14, 2007 Try using ConsoleWrite in scriptB instead of StdinWrite. Link to comment Share on other sites More sharing options...
59FIFTY Posted January 14, 2007 Author Share Posted January 14, 2007 Now I'm ashamed..... Thanks for the help Link to comment Share on other sites More sharing options...
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