Checking command prompt window

Question ID: 105378
0
0

In my scripts, I want to be able to check data that is on the command prompt window. It’s just seen as a box.

Marked as spam
Posted by (Questions: 188, Answers: 22)
Asked on April 29, 2014 4:08 pm
9 views
Answers (1)
2
Private answer

You could use the GetVisibleText as one way to do a screen scrape of the text and store it in a variable. I also have a couple of examples below of what to do with the text.

var_GetVisibleText = Window(''Command'').GetVisibleText() 'Grabs the displayed text and stores in variable
Print var_GetVisibleText 'used just to see the output data
'You could also use different string manipulation with the text depending on what you want to do:

' Use Split to create an array for later use:

output_array = Split (var_GetVisibleText,'' '') 'or whatever delimiter you want to use

' Use InStr to find a value in the variable string text

found_pos = InStr (var_GetVisibleText, ''Microsoft'')
If found_pos > 0 Then
Reporter.ReportEvent micPass,''Output Check'', ''The string was found in the text.''
Else
Reporter.ReportEvent micFail,''Output Check'', ''The string was not found.''
End If

Marked as spam
Posted by (Questions: 2, Answers: 438)
Answered on April 29, 2014 4:10 pm