mashrino

Console read

8 posts in this topic

Hi,

Local $sOutput

While True
        $sOutput &= ConsoleRead()
        If @error Then ExitLoop
        Sleep(25)
WEnd
MsgBox($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

Share this post


Link to post
Share on other sites



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 Then

MsgBox($MB_SYSTEMMODAL, "", "entered the if condition" & $string2)

EndIf

Share this post


Link to post
Share on other sites

$Output has "notepad" which I give as input through command prompt

Share this post


Link to post
Share on other sites

$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)

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites

Thanks chimp it is working. :):)

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now