Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Check Text files and sent email notification (VB6)

    How can i write a small program to check contains 0f a text files details
    (as attached : UpdateDB.err) ,

    Normally the last row of this errorlog file
    will be like this :
    2005_06_07 00:15:23 Exiting.

    Sometimes if there are Failure of system this errorlog file
    will just stop without the last row mentioning Exiting.

    how to write a vb prog if found that errorlog files not containing Exiting.
    word,it will make an email notification using lotus notes to sent email related persons.

    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Melbourne, Victoria, Australia
    Posts
    5,016
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check Text files and sent email notification (VB6)

    To check for the existence of the string " Exiting." in such a small text file, you could use a simple VB script like:
    <code>
    Const ForReading = 1, ForWriting = 2
    Dim fso, f
    Set fso = CreateObject("Scripting.FileSystemObject")
    Set f = fso.OpenTextFile("c:UpdateDB.err", ForReading)
    ReadAllTextFile = f.ReadAll
    if instr(1, ReadAllTextFile, " Exiting.") = 0 then msgbox "Exiting not found."
    </code>

    Can't help with the e-mail notification though, sorry.

    Alan

  3. #3
    Lounger
    Join Date
    Dec 2004
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check Text files and sent email notification (VB6)

    Hi Thanks Alots, it did helps ..
    do you know how should i send dos command from vb program?
    net send ipxx.xx.xx.xx Messages

    Thanks..

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Check Text files and sent email notification (

    VB has a Shell command that might work to execute that command line (I didn't try it). If you need to wait for the results, it's a bit more complicated, of course.

  5. #5
    Silver Lounger
    Join Date
    Jun 2002
    Location
    Cheadle, Staffordshire
    Posts
    2,177
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Check Text files and sent email notification (VB6)

    You could use the MAPI controls to send the error log ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •