anhyeuem Posted April 26, 2014 Share Posted April 26, 2014 (edited) Hello my teachers and friends, Wen I run a program: Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText) I receive a console as result. But i don't like console, i use: Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE) Okay, very good. But i need a msgbox is contained from console or can you show me: how to create a log.txt - this file has content of console. Thank you so much. P,sDear Mr. Melba23 How are you? Can you help me? Edited April 26, 2014 by anhyeuem Link to comment Share on other sites More sharing options...
FireFox Posted April 26, 2014 Share Posted April 26, 2014 Hi, Take a look at StdoutRead in the helpfile. Br, FireFox. anhyeuem 1 Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 Hi, Take a look at StdoutRead in the helpfile. Br, FireFox. oh, thank you so much, my friendsStdoutRead vs StdErrRead : i have just read it and i don't understand 100% I am also newbie at autoit Can you show me more and more thanks Link to comment Share on other sites More sharing options...
FireFox Posted April 26, 2014 Share Posted April 26, 2014 (edited) It's not related to autoit, you can find on internet the difference between them. The standard output corresponds to ConsoleWrite and standard error corresponds to ConsoleWriteError in autoit. The developer chooses to wether write in one of them, depending on wether it's an information or an error. Br, FireFox. Edited April 26, 2014 by FireFox anhyeuem 1 Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 It's not related to autoit, you can find on internet the difference between them. The standard output corresponds to ConsoleWrite and standard error corresponds to ConsoleWriteError in autoit. The developer chooses to wether write in one of them, depending on wether it's an information or an error. Br, FireFox. Thank you for reply. Okay, i am going search from google and read them. With me: a pupil 12 age, it is very difficult. this is a exam, a my homework from teacher. I need example then try and i will understand. Link to comment Share on other sites More sharing options...
Gianni Posted April 26, 2014 Share Posted April 26, 2014 Hi anhyeuem also, try this (note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....) #include <Constants.au3> Local $dos_output = "" ; declare a variable to get output ; execute your program hidden and with output redirected Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) ; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example While Not @error ; wait the end of your program $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program Werty and anhyeuem 2 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 (edited) Hi anhyeuem also, try this (note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....) #include <Constants.au3> Local $dos_output = "" ; declare a variable to get output ; execute your program hidden and with output redirected Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) ; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example While Not @error ; wait the end of your program $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program oh, this is perfect. Almost pupils from my shool are reading and using this code. They are talking and comment. But my friend:$a = (GUICtrlRead($hFileInput))$hFileInput = GUICtrlCreateInput( "", 19, 33, 474, 19)... $t ...$szText : they are like $a: GUICtrlCreateInput -> your code don't show content of console. can you help me Edited April 26, 2014 by anhyeuem Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 Hi anhyeuem also, try this (note that this will work only if your program, that is contained in the $a variable, will allow I/O redirection....) #include <Constants.au3> Local $dos_output = "" ; declare a variable to get output ; execute your program hidden and with output redirected Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) ; Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example While Not @error ; wait the end of your program $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program If i use: Local $cmd = Run("ping localhost", "", @SW_HIDE, $STDOUT_CHILD) ; this is a working example it is very good, by my case, it can't not show very poor my friend Link to comment Share on other sites More sharing options...
Gianni Posted April 26, 2014 Share Posted April 26, 2014 (edited) what is the program that you want to run? (what is the content of the $a variable?) edit: ....I had not seen the post # 7 sorry Edited April 26, 2014 by PincoPanco anhyeuem 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 what is the program that you want to run? (what is the content of the $a variable?) I run signtool.exe with parameter do you have teamviewer software? myid: 433 082 431 pass: h353gx -> you can see my computer and you will understand them Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 (edited) what is the program that you want to run? (what is the content of the $a variable?) #include <Constants.au3> Local $dos_output = "" ; declare a variable to get output $a = "C:\test\signtool.exe" $t = "http:/google.com" $f = "C:\test\mycert.pfx" $p = "password" $szText = = "C:\test\test.exe" Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) While Not @error ; wait the end of your program $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program -> very good my friend it can show very good But my case: i create GUICtrlCreateInput... $hFileInput = GUICtrlCreateInput( "", 19, 33, 474, 19) ... $a = GUICtrlRead($hFileInput) $t = GUICtrlRead($hTime) ... -> not show ( Edited April 26, 2014 by anhyeuem Link to comment Share on other sites More sharing options...
Gianni Posted April 26, 2014 Share Posted April 26, 2014 (edited) I do not know the signtool.exe program, and I do not know if it allows I/O redirection, anyway you could try to change $STDOUT_CHILD with $STDERR_MERGED instead in this way you could see also error messages coming from that dos program. (always if it allows i/o redirection....) Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDERR_MERGED) p.s. I do not recommend putting passwords online .... EDIT corrected $STDERR_MERGED Edited April 26, 2014 by PincoPanco Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... Link to comment Share on other sites More sharing options...
anhyeuem Posted April 26, 2014 Author Share Posted April 26, 2014 I do not know the signtool.exe program, and I do not know if it allows I/O redirection, anyway you could try to change $STDOUT_CHILD with $STDERR_MERGED instead in this way you could see also error messages coming from that dos program. (always if it allows i/o redirection....) Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDERR_MERGED) p.s. I do not recommend putting passwords online .... EDIT corrected $STDERR_MERGED Dear my friend all pupil from my school want to say: "thank you so much" #include <Constants.au3> Local $dos_output = "" ; declare a variable to get output $a = "C:\test\signtool.exe" $t = "http:/google.com" $f = "C:\test\mycert.pfx" $p = "password" $szText = = "C:\test\test.exe" Local $cmd = Run($a & " a" & " /t " & $t & " /d " & $d & " /du " & $du & " /f " & $f & " /p " & $p & " /v " & $szText, "", @SW_HIDE, $STDOUT_CHILD) While Not @error ; wait the end of your program $dos_output &= StdoutRead($cmd) ; get the output from your program while is running WEnd MsgBox(0, "", $dos_output) ; display the final output of your program Code above is okay, we use it for our homework. But can you tell me why? Run: okay but Runwait: don't show msgbox ???? Link to comment Share on other sites More sharing options...
Gianni Posted April 26, 2014 Share Posted April 26, 2014 Dear my friend all pupil from my school want to say: "thank you so much" You are welcome Code above is okay, we use it for our homework. But can you tell me why? Run: okay but Runwait: don't show msgbox ???? I think because RunWait stops the execution of your main script untill the exe program has finished so in this way you can not grab his output, but also because, according to the help file, RunWait does not allows Output redirection and so you can't pipe the output of the executed program to your scrpt. (this is obvious, because if the main program stops untill the launched exe has finished, then there is no way to control it in the while....) bye anhyeuem 1 Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt.... 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