Jump to content

Recommended Posts

Posted

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

Posted

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

Posted

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

 

image.jpeg.9f1a974c98e9f77d824b358729b089b0.jpeg Chimp

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...