JeffQOOQAAA

How to catch need file

5 posts in this topic

#1 ·  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

Share this post


Link to post
Share on other sites



#2 ·  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.

Share this post


Link to post
Share on other sites

#3 ·  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:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

#4 ·  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

Share this post


Link to post
Share on other sites

#5 ·  Posted

Thanks for all reply~ 

I'll  try this~

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