It is currently April 19th, 2024, 2:19 am

Rainmeter Log Window

Skins that control functions in Windows or Rainmeter
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Rainmeter Log Window

Post by tass_co »

Hi everyone,

I made a skin that instantly displays the last 5 messages in the Rainmeter Log file content.
(This number can be increased)

I believe it can help in some cases :phhht

21.09.2022 - 03.28.29-About Rainmeter.png



Skin ini

Code: Select all

[Rainmeter]
Update=1000

[Variables]
LogFile="#SETTINGSPATH#Rainmeter.log"
LastWritten1=
LastWritten2=
LastWritten3=
LastWritten4=
LastWritten5=

[MeaLua]
Measure=Script
ScriptFile="#CURRENTPATH#LuaWrite.lua"
FileName=#Path#

[MtrShape]
Meter=Shape
X=0
Y=0
Shape=Rectangle 0,0,306,178 | Extend MyModifiers1
MyModifiers1=Fill Color 0,0,0 | StrokeWidth 2 | Stroke Color 255,0,0

[Strtime]
Meter=String
X=4
Y=4
W=300
H=174
SolidColor=0,0,0
StringStyle=Normal
StringAlign=Left
FontSize=10
FontFace=URW DIN SemiCond W05 Demi
FontColor=240,240,240
ClipString=1
Text=#LastWritten1##CRLF##LastWritten2##CRLF##LastWritten3##CRLF##LastWritten4##CRLF##LastWritten5#
AntiAlias=1
DynamicVariables=1
LuaWrite.lua

Code: Select all

function Initialize()

	FileName = SKIN:GetVariable('LogFile')
	
end

function Update()
	FilePath = SKIN:MakePathAbsolute(FileName)
	local file = io.open(FilePath, 'r')
	fLines = {}
		for line in file:lines() do
			table.insert(fLines, line)
		end
	local count = 0
	for line in io.lines(FilePath) do
	   count = count + 1
	end
	file:close()
	cLine = count - 1
	SKIN:Bang('!SetVariable', 'LastWritten1', fLines[cLine + 1])
	SKIN:Bang('!SetVariable', 'LastWritten2', fLines[cLine])
	SKIN:Bang('!SetVariable', 'LastWritten3', fLines[cLine - 1])
	SKIN:Bang('!SetVariable', 'LastWritten4', fLines[cLine - 2])
	SKIN:Bang('!SetVariable', 'LastWritten5', fLines[cLine - 3])
end
Rainmeter Log_1.0.rmskin
You do not have the required permissions to view the files attached to this post.
I don't know where i going from here, but i promise it won't be boring... :great:
User avatar
Kurou
Posts: 41
Joined: January 24th, 2022, 2:54 pm
Location: World Wide Web

Re: Rainmeter Log Window

Post by Kurou »

tass_co wrote: September 21st, 2022, 12:35 am Hi everyone,

I made a skin that instantly displays the last 5 messages in the Rainmeter Log file content.
(This number can be increased)
Looks nice but i think you can achieve the same result in better way.

Rainmeter Code:

Code: Select all

[Line_1]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
ClipString=1
W=([Background:W] - 5)
X=0
Y=35

[Line_2]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_3]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_4]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_5]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_6]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_7]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_8]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_9]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_10]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_11]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_12]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_13]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_14]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_15]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_16]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_17]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r

[Line_18]
Meter=String
MeterStyle=Normal
Padding=5, 0, 0, 0
W=([Background:W] - 5)
X=0r
Y=25r
Lua Code:

Code: Select all

function Debugger()
    -- File path
    local log_path = folders["settings"]..'\\Rainmeter.log'
    local lines = {}

    -- Open the file
    local log_file = io.open(log_path, 'r')
    if not log_file then
        print("Lua Error | Debugger("..log_path..") Rainmeter log file was not found!")
    end

    -- Read lines
    for line in log_file:lines() do
        lines[#lines + 1] = line
        if #lines > 18 then
            table.remove(lines, 1)
        end
    end

    -- Close the file
    log_file:close()

    -- Reverse the lines
    local log_lines = {}
    for i = #lines, 1, -1 do
        log_lines[#log_lines + 1] = lines[i]
    end

    --  Inesert lines
    for i, line in ipairs(lines) do
        local MeterName = "Line_" .. i
        local words = line:match("(%S+)%s+(%S+)%s+(%S+)%s+(%S+)") 

        if words == "NOTE" then
            SKIN:Bang("!SetOption", MeterName, "FontColor", "255, 255, 255")
        elseif words == "WARN" then
            SKIN:Bang("!SetOption", MeterName, "FontColor", "255, 100, 0")
        elseif words == "ERRO" then
            SKIN:Bang("!SetOption", MeterName, "FontColor", "255, 0, 0")
        end
        SKIN:Bang("!SetOption", MeterName, "Text", line)
    end
    SKIN:Bang("!Redraw", names["root"]..'\\control\\debugger', 'debugger.ini')
end
Brought to you by: https://kurou.dev/
User avatar
tass_co
Posts: 513
Joined: May 4th, 2020, 3:01 pm
Location: Ankara, TURKEY

Re: Rainmeter Log Window

Post by tass_co »

Kurou wrote: May 28th, 2023, 7:55 pm Looks nice but i think you can achieve the same result in better way.
:great:
I don't know where i going from here, but i promise it won't be boring... :great: