Jump to content

Recommended Posts

Posted

Dears

I have some information and need to catch what I need 

Information like this

Sstatus have Passed, notrun, canceled, fail

But I only want to cache failed item name.

How can I do this ......  Thanks!

 

Windows Client System Check For WDDM 1.3 Display Driver Support:Passed
Verifies PS2 Devices have a unique Plug and Play ID:NotRun
Camera Driver System Test - MediaCapture - TestValidateVariablePhotoSequenceFrameMetadata:Canceled

WGF Feature Level 9.3 Support (WoW64):Failed

Posted

use FileReadToArray() to read the text into an array so you can process it line by line. on each line, use StringRight() to determine if the end of the string matches the required phrase. not that hard, really.

Signature - my forum contributions:

  Reveal hidden contents

 

Posted (edited)

Something like this:

Global $aTemp
Global $aMessages[] = ["Windows Client System Check For WDDM 1.3 Display Driver Support:Passed", "Verifies PS2 Devices have a unique Plug and Play ID:NotRun", _
    "Camera Driver System Test - MediaCapture - TestValidateVariablePhotoSequenceFrameMetadata:Canceled", "WGF Feature Level 9.3 Support (WoW64):Failed"]
For $i = 0 To UBound($aMessages) - 1
    $sTemp = StringSplit($aMessages[$i], ":")
    MsgBox(0, "Result", "Check: " & $sTemp[1] & @CRLF & "Result: " & $sTemp[2])
Next

If there is more than one colon in the text the code needs to be modified.

Edited by water

My UDFs and Tutorials:

  Reveal hidden contents

 

Posted

An SRE version...

#include <array.au3>

; name of file containing messages to search for
local $infile = @scriptdir & '\find text test01.txt'

; open file in read mode (default)...if error exit with message
local $hfl = fileopen($infile)
if $hfl = -1 then exit msgbox(17,'Error','File open failed !' & @CRLF & 'File = ' & $infile)

; read file to string variable
local $sFileString = fileread($hfl)

; find all instances of ":Failed" in file and capture the name portion of the line
local $aFailed = stringregexp($sFileString,'(.*?):Failed',3)

; display the resulting array
_arraydisplay($aFailed)

File used = find text test01.txt

kylomas

Forum Rules         Procedure for posting code

"I like pigs.  Dogs look up to us.  Cats look down on us.  Pigs treat us as equals."

- Sir Winston Churchill

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...