Jump to content

help retrieve a value from a text file


Recommended Posts

Hello. I have a log file:

Example of text file

THERE ARE LOTS OF VALUES IN THIS TEXT FILE BUT I ONLY WANT TO RETRIEVE WHAT IS IN BETWEEN THE EXIT CODE VALUES <ExitCode>14566</ExitCode>

I would like to search that log file and only get what is between the <ExitCode>??????</ExitCode> markers.

Can you help me with this please, I have an example and I can find the position in number format, but I dont know where to go from there to get the actual value. Do i want to string left from there??

$file = FileRead("C:\test.log")
$result = StringInStr($file, "</ExitCode>")


if $result then
    MsgBox(0, "Found it", "Found it at character position: " & $result)
Else
    MsgBox(0, 'Not Found', "String Not Found")
EndIf

Thanks,

Link to comment
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
 Share

  • Recently Browsing   0 members

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