Jump to content
JeffQOOQAAA

How to catch need file

Recommended Posts

JeffQOOQAAA

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
orbs

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
water

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 (2018-06-01 - Version 1.4.9.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2018-09-01 - Version 1.3.4.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
kylomas

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
JeffQOOQAAA

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

×