require ‘time’
require ‘Win32API’
require “win32/eventlog”
include Win32
handle = EventLog.open(“Application”)
handle.total_records # e.g. 916
handle.oldest_record_number # e.g. 1
def message_box(msg=’’,title=‘EventLog’,button=0)
api = Win32API.new(‘user32’,‘MessageBox’,[‘L’, ‘P’, ‘P’, ‘L’],‘I’)
r = api.call(0,msg,title,0)
return r
end
def data_select
each log[“time_written”] do |log|
time.parse: ri time.parse
if
[0] == <= time.now -360000
[0] = time_written
else
print “this is not working”
end
end
def time_format
each log[“time_written”] do |log|
Time.strftime("%d-%m-%Y %I%H:%M %p")
end
#today = Time.now
#today -= 360000
#sTime = Time.now.strftime("%d-%m-%Y %I%H:%M %p")
return Time
end
def html_header(title)
html = “”
html += “#{title}”
html += “\n”
return html
end
def html_heading1(heading)
html = “
#{heading}
\n”return html
end
def html_table
html = “
RecNo: | Time Recorded: | Record Type: |
Description: |
---|---|---|---|
#{record_number} | #{time_written} | #{event_type} | #{description} |
html_file.printf("%s", html)
html_file.close
handle.close
message_box(“Congrats. The EventLog is now viewable in HTML.”)
AM I ON THE RIGHT TRACK OR CAN SOMEONE GIVE ME A SOLUTION FOR THE ABOVE
SUBJECT WHAT HAS BEEN ASKED IS THAT WE READ IN THE LAST 100HRS OF THE
EVENT LOG AND CONVERT THE TIME TO STANDARDIZED FORMAT THAT IS READABLE
BY THE COMMON MAN INTO A HTML DOCUMENT… PLEASE HELP I AM STUCK AS IM
NOT SURE IF THIS IS AN ARRAY IN STRING FORMAT OR AS AN OBJECT
(SPECIFICALLY AS A TIME ONE)… ANY HELP WOULD BE GREAT THANKS IN
ADVANCE
STUDENT