mary Posted August 31, 2007 Share Posted August 31, 2007 hi ! My autoit script call a dll and this dll send data to stdout of caller ( i.e my compiled script). It work with other script language (python, rubby....) but not with autoit . so my question is : is it possible to read our own stdout ? thinks Link to comment Share on other sites More sharing options...
chenxu Posted August 31, 2007 Share Posted August 31, 2007 hi !My autoit script call a dll and this dll send data to stdout of caller ( i.e my compiled script). It work with other script language (python, rubby....) but not with autoit . so my question is :is it possible to read our own stdout ?thinks It is possible to do what you need. just look into the help file to this command: StdoutRead Link to comment Share on other sites More sharing options...
mary Posted August 31, 2007 Author Share Posted August 31, 2007 It is possible to do what you need. just look into the help file to this command: StdoutRead StdoutRead not work ! Just a precision: what i mean is StdoutRead(@AutoItPID) ! because the dll that i call send result in stdout of caller (wich is my script )when call this dll in SciTE Editor, it send me the result in editor without using consolewrite !any idea ? Link to comment Share on other sites More sharing options...
The Kandie Man Posted August 31, 2007 Share Posted August 31, 2007 Hello Mary, I have spent the past half an hour trying to get AutoIt to read the Stdout from a called dll. I wrote a simple dll, called it and tried a variety of functions, ConsoleRead(), StderrRead(), and StdoutRead. It doesn't appear that an AutoIt script can currently read its own output. This is a serious limitation. If one of the developers knows a way I am all ears. It appears that the only way you can do it right now is by reading std streams of parent and child processes. As such, there is one alternative. You could create a child script that is executed by the main AutoIt script. The child script will call the dll and then the dll will give the output. The parent AutoIt script will then receive the output of the child AutoIt process which would include the stdoutput of the called dll. I then spent some time making an alternative way to do it. Here is how I did it just now: Parent.au3Dim $i_PID = Run(@AutoItExe & ' /AutoIt3ExecuteScript "child.au3"',"",@SW_HIDE,1+2+4) Dim $s_Output While ProcessExists($i_PID) $s_Output = StdOutRead($i_PID) MsgBox(0,"Output:",$s_Output,1) ConsoleWrite($s_Output) WEndoÝ÷ Ø(b֮ݫ¢+Ù¥´ÀÌØí¡}±°ô±±=Á¸ ÅÕ½ÐíM¥µÁ±=ÕÑÁÕѱ±½ÉQÍй±°ÅÕ½Ðì¤)¥´ÀÌØí¥}Q¥µÈôQ¥µÉ%¹¥Ð ¤)¥´ÀÌØí¥}IÑÕɸ)]¡¥±Q¥µÉ¥ ÀÌØí¥}Q¥µÈ¤±ÐìÔÀÀÀ((ÀÌØí¥}IÑÕɸô±± ±° ÀÌØí¡}±°°ÅÕ½Ðí¥¹Ðé°ÅÕ½Ðì°ÅÕ½ÐíMÅÕ½Ðì¤()]¹)±± ±½Í ÀÌØí¡}±° I hope you find this useful. - The Kandie Man ;-)SimpleOutputDllForTest.dll "So man has sown the wind and reaped the world. Perhaps in the next few hours there will no remembrance of the past and no hope for the future that might have been." & _"All the works of man will be consumed in the great fire after which he was created." & _"And if there is a future for man, insensitive as he is, proud and defiant in his pursuit of power, let him resolve to live it lovingly, for he knows well how to do so." & _"Then he may say once more, 'Truly the light is sweet, and what a pleasant thing it is for the eyes to see the sun.'" - The Day the Earth Caught Fire Link to comment Share on other sites More sharing options...
Developers Jos Posted August 31, 2007 Developers Share Posted August 31, 2007 (edited) I am not sure if you can connect to the STDOut stream after the program is started. Maybe DaveF knows, But,... Taking your idea one step futher you should be able to do it in one script as well with something like this : (untested) If $CMDLine[0] = 1 and $CMDLine[1] = "CallDll" Then CallDll() Exit EndIf ; ; ; Call DLL that produces STDOUT Dim $s_Output $i_PID = Run(@ScriptFullPath & ' CallDll',"",@SW_HIDE,1+2+4) While ProcessExists($i_PID) $s_Output = StdOutRead($i_PID) MsgBox(0,"Output:",$s_Output,1) ConsoleWrite($s_Output) WEnd ; ; Func CallDll() Dim $h_Dll = DllOpen("SimpleOutputDllForTest.dll") Dim $i_Timer = TimerInit() Dim $ai_Return While TimerDiff($i_Timer) <5000 $ai_Return = DllCall($h_Dll,"int:cdecl","ASDF") WEnd DllClose($h_Dll) EndFunc Edited August 31, 2007 by JdeB SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mary Posted August 31, 2007 Author Share Posted August 31, 2007 thinks "The Kandie Man" ! Exactly ! it is an autoit limitation Thinks for all tests and for your solution . ok, for my project i'll better to code it in python. I like autoit but....anyway 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