It is currently September 29th, 2024, 7:30 pm

Event viewer

General topics related to Rainmeter.
User avatar
nickzlapeor
Posts: 16
Joined: December 28th, 2012, 5:22 pm
Location: Mumbai, India

Event viewer

Post by nickzlapeor »

Is there a way to extract info from the Event Viewer, like the last Shutdown time and date. The registry in Win 8 shows the last Restart time instead of Shutdown. I know the Registry can show Shutdown time, but -> 1. Only UTC format, 2. How to extract it from Registry to be used with Rainmeter. Any help?
Last edited by nickzlapeor on August 21st, 2013, 7:31 pm, edited 1 time in total.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Event viewer

Post by thatsIch »

I am not sure, how to extract from Event Viewer, but you can always save it in rainmeter itself the time and parse it back.
User avatar
nickzlapeor
Posts: 16
Joined: December 28th, 2012, 5:22 pm
Location: Mumbai, India

Re: Event viewer

Post by nickzlapeor »

Sorry I'm a noob, I didn't get what and how can it be done.
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Event viewer

Post by thatsIch »

I mean you have something running in the backround of your skin which stores the current time, or time interval: Like a Lua script. This will save the time in variable fields like
lastHour = xx
lastMin = xx
lastSec = xx
and then you have the data avaiable on next startup

Code: Select all

[mHour]
Meter = String
Text = %lastHour%
User avatar
nickzlapeor
Posts: 16
Joined: December 28th, 2012, 5:22 pm
Location: Mumbai, India

Re: Event viewer

Post by nickzlapeor »

Didn't get it. Won't the time change on startup?

I know nothing about Lua so detailed help would be appreciated, if possible. Many thanks for replying though!
User avatar
sa3er
Posts: 152
Joined: March 2nd, 2013, 7:18 am
Location: Tehran

Re: Event viewer

Post by sa3er »

It's stored in HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Windows\ but the value of ShutdownTime is in Binary mode and I've no idea if Rainmeter supports this.
User avatar
nickzlapeor
Posts: 16
Joined: December 28th, 2012, 5:22 pm
Location: Mumbai, India

Re: Event viewer

Post by nickzlapeor »

Need expert help!
User avatar
sa3er
Posts: 152
Joined: March 2nd, 2013, 7:18 am
Location: Tehran

Re: Event viewer

Post by sa3er »

Well I've checked the online manual of Rainmeter and just saw that Registry measure doesn't support REG_BINARY.

I don't know about Lua but you can simply use this VBScript to read the value in that key and export it to a text file and then parse it using the WebParser measure.

Copy the below code and save it in a new file with .vbs extension.

Code: Select all

strValueName = "HKLM\SYSTEM\CurrentControlSet\Control\Windows\" & "ShutdownTime"
Set oShell = CreateObject("WScript.Shell")
Ar = oShell.RegRead(strValueName)
Term = Ar(7)*(2^56) + Ar(6)*(2^48) + Ar(5)*(2^40) + Ar(4)*(2^32) + Ar(3)*(2^24) + Ar(2)*(2^16) + Ar(1)*(2^8) + Ar(0)
Days = Term/(1E7*86400)
ShutTime = CDate(DateSerial(1601, 1, 1) + Days) & " UTC"
TextPath = "D:\ShutDownText.txt"
Set ShutText = CreateObject("Scripting.FileSystemObject").OpenTextFile(TextPath,2 ,True)
ShutText.WriteLine ShutTime
ShutText.Close
Set ShutText = Nothing
;)
User avatar
thatsIch
Posts: 446
Joined: August 7th, 2012, 9:18 pm

Re: Event viewer

Post by thatsIch »

I dont think you can access the Registry from Lua, but you can write to and read from files. Date/Times have Integer representation which can be easily transformed, but I guess many roads lead to rome!