EndFunc Posted June 3, 2015 Posted June 3, 2015 (edited) Whenever I try to run this simple command it does not work with the constants at the end. If I remove the $STDERR_CHILD and $STDOUT_CHILD, the command works but of course I can't capture the text. I've tried many ways. I have the autoconstants include declared also. I looked at other topics in the forum and many are very old but didn't seem to be this scenario. AutoIt ver 3.3.12 Local $get = Run(@ComSpec & " /c ipconfig","",@SW_SHOW,$STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput = StdoutRead($get) If @error Then ExitLoop EndIf MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) WEnd Edited June 3, 2015 by EndFunc EndFuncAutoIt is the shiznit. I love it.
MuffinMan Posted June 3, 2015 Posted June 3, 2015 #include<MsgBoxConstants.au3> #include<AutoItConstants.au3> Local $get = Run(@ComSpec & " /c ipconfig","",@SW_SHOW,$STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput = StdoutRead($get) If @error Then ExitLoop EndIf MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) Run("notepad.exe") Send($sOutput) WEndThis code worked well for me. What kind of error are you getting?
EndFunc Posted June 3, 2015 Author Posted June 3, 2015 Ah, I'm stupid for not noticing that. The script wasn't giving an error at all it was running through and not outputting anything. The problem was the the msgbox. Instead of giving me an error because I didn't include MsgBoxConstants.au3 it just seem to ignore it so the script just ran and did nothing. Normally it should say their is a variable not defined. Thanks for clarity and 2nd set of eyes. EndFuncAutoIt is the shiznit. I love it.
iamtheky Posted June 3, 2015 Posted June 3, 2015 You could also do it like so:#include<AutoItConstants.au3> Local $get = Run(@ComSpec & " /c ipconfig","",@SW_SHOW,$STDERR_CHILD + $STDOUT_CHILD) $sOutput = "" While ProcessExists($get) $sOutput &= StdoutRead($get) WEnd MsgBox(0, "Stdout Read:", $sOutput) The original example also kind of fails in logic, as the first msgbox is empty everytime because there is no data...yet, and then i click ok and the second has data in it because by that time $sOutput has been populated.#include<MsgBoxConstants.au3> #include<AutoItConstants.au3> Local $get = Run(@ComSpec & " /c ipconfig","",@SW_SHOW,$STDERR_CHILD + $STDOUT_CHILD) While 1 $sOutput = StdoutRead($get) If @error Then ExitLoop EndIf MsgBox($MB_SYSTEMMODAL, "Stdout Read:", $sOutput) WEnd ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__)
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