Write to System Event Log

Example scripts and tips (replaces Old Scripts & Tips archive)

Moderators: Dorian (MJT support), JRL, Phil Pendlebury

Post Reply
User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Write to System Event Log

Post by Marcus Tettmar » Wed Feb 01, 2006 8:18 am

Some code for writing to the Application Event Log. Could be used to log different outcomes during script execution.

VBSTART
'WriteEvent
'eventtype: 0 = information
' : 1 = error
' : 2 = warning
Sub WriteEvent(eventtype, message)
Set objShell = CreateObject("Wscript.Shell")
objShell.LogEvent eventtype, message
Set objShell = Nothing
End Sub
VBEND

//Log Success
VBRun>WriteEvent,0,Script Started

//Log An Error
VBRun>WriteEvent,1,Oops
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts