brockaf Posted February 3, 2006 Share Posted February 3, 2006 Hi; My humble attempt to log Events Global $EVENTLOG_SUCCESS = 0x0000 Global $EVENTLOG_ERROR_TYPE = 0x0001 Global $EVENTLOG_WARNING_TYPE = 0x0002 Global $EVENTLOG_INFORMATION_TYPE = 0x0004 Global $EVENTLOG_AUDIT_SUCCESS = 0x0008 Global $EVENTLOG_AUDIT_FAILURE = 0x0010 ;------------------------------------------------------- ; Event Log Function ;------------------------------------------------------- Func Logit (ByRef $Message2, $TYPE_OF_MESSAGE) Local $Message1 Local $DQ $DQ = Chr(34) $file = FileOpen("LogMdownTimeEvent.vbs", 2) ; Check if file opened for writing OK If $file = -1 Then MsgBox(0, "Error", "Unable to open file.") Exit EndIf FileWrite($file, "Const EVENT_SUCCESS = " & $TYPE_OF_MESSAGE & @CRLF) $Message1 = "set objShell = Wscript.CreateObject (" & $DQ & "Wscript.Shell" & $DQ & ")" FileWrite($file, $Message1 & @CRLF) $Message1 = "objShell.LogEvent EVENT_SUCCESS," FileWrite($file, $Message1 & ' ' & $DQ & $Message2 & $DQ & @CRLF) FileClose($file) $rc = _RunDos ("start LogMdownTimeEvent.vbs") EndFunc ;==>Logit =============================== Here is how it works $Message2 = "Mictobiology Dowmtine for " & $THIS_LAB & ": Started" $TYPE_OF_MESSAGE = $EVENTLOG_INFORMATION_TYPE Logit ($Message2, $TYPE_OF_MESSAGE) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now