antmar904

Find String in txt file

5 posts in this topic

Hi,

I am trying to find the string "Cert1" in a txt file and if found display a message and if not found display a message but i'm stuck.

Local $CertLog = @ScriptDir & "\CompCertChk.txt"
Local $hFileOpen = FileOpen($CertLog, 0)
Local $Content = FileRead($hFileOpen)
FileClose($hFileOpen)
Local $aString = StringRegExp($Content, "Cert1", 0, "")
If @error = "1" Then
    MsgBox("", "", "Cert is installed")
    Exit
Else
    If @error = "0" Then
        MsgBox("", "", "Cert is NOT installed")
        Exit (63)
    EndIf
EndIf

 

Share this post


Link to post
Share on other sites



Yes that worked, thanks.  I figured I was over complicating things :) 

Share this post


Link to post
Share on other sites

How would I properly use the @error being returned? 

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