Sign in to follow this  
Followers 0
kkurniawan

Write to Windows Event Log from application log file

2 posts in this topic

Hi there,

I have an application that writes an error to log file and I write the error to windows event log manually. I wonder if I can use AutoIt script to specify the location of the error file in the script and the script reads the error file content and write to windows event log automatically.

This is what I have so far:

Set WshShell = WScript.CreateObject("WScript.Shell")

strCommand = "eventcreate /T Error /ID 100 /L CP-Link /D " & _

Chr(34) & "Cannot connect to unit." & Chr(34)

WshShell.Run strcommand

Any help/suggestion is highly appreciated.

Thanks,

Senukung

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

With AutoIt you can use:

$SystemEvent='eventcreate /T Error /ID 999 /L SYSTEM /SO AutoItScript /D "A Event Created with AutoIt "'

Run(@ComSpec & " /c " & $SystemEvent, "", @SW_HIDE)

Be careful with the OS Language

Entry Application is in German ANWENDUNG

tested with windows XP

good luck for your script :lmao:

Edited by Micha1405

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
Sign in to follow this  
Followers 0