mashrino Posted September 23, 2015 Posted September 23, 2015 Hi,Local $sOutputWhile True $sOutput &= ConsoleRead() If @error Then ExitLoop Sleep(25)WEndMsgBox($MB_SYSTEMMODAL, "", $sOutput)for the above code I am reading data from a command window using consoleread. The output I am getting from ConsoleRead() is stored in a variable $sOutput.Here my question is the output I am getting from consoleread is a string?Thanks
JohnOne Posted September 23, 2015 Posted September 23, 2015 Test it with VarGetType($sOutput) AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mashrino Posted September 23, 2015 Author Posted September 23, 2015 Thanks for the reply. I can find the variable is a string.In command window I am giving "echo notepad | example.exe ". When $sOutput and $string2 (where I have already declared "notepad") matches it should go inside the if condition.But it is not working.Code:MsgBox($MB_SYSTEMMODAL, "", $sOutput) --> It gives the result "notepad"Global $string2 = "notepad"if $sOutput == $string2 ThenMsgBox($MB_SYSTEMMODAL, "", "entered the if condition" & $string2)EndIf
JohnOne Posted September 23, 2015 Posted September 23, 2015 (edited) So what does it contain, the value of $Output? Edited September 23, 2015 by JohnOne AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
mashrino Posted September 23, 2015 Author Posted September 23, 2015 $Output has "notepad" which I give as input through command prompt
JohnOne Posted September 23, 2015 Posted September 23, 2015 Provide runnable code, your script does nothing at all. AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans.
Gianni Posted September 23, 2015 Posted September 23, 2015 $sOutput could contains a carriage return or a line feed (or both characters) at his end. check the length of the strings to see if they have the same length.MsgBox(0,"",Stringlen( $sOutput) & " <-> " & Stringlen( $string2))if this is the case, then you could clean $sOutput from extra characters using for example:StringStripWS ($sOutput, 2) Chimp small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....
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