Lack of interest? Not from my side, but perhaps if we show you....
Here's what I've been doing with your plugin:
Your bog-standard Process.ini:
Code: Select all
[Rainmeter]
Update=1000
AccurateText=1
....................................................................................................................................................
[Variables]
@Include="#CURRENTPATH#..\D10Variables.inc"
UpdDiv=2
........................................................................................................................................................
; NomFerp Measures
[CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
Order=% Processor Time
Mode=Difference
Filter=_Total|Idle|Rainmeter
UpdateDivider=#UpdDiv#
[1CPUName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=name
Instance=1
[1CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=% Processor Time
Mode=DifferenceTotalPercent
Instance=1
[2CPUName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=name
Instance=2
[2CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=% Processor Time
Mode=DifferenceTotalPercent
Instance=2
[3CPUName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=name
Instance=3
[3CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=% Processor Time
Mode=DifferenceTotalPercent
Instance=3
[4CPUName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=name
Instance=4
[4CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=% Processor Time
Mode=DifferenceTotalPercent
Instance=4
[5CPUName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=name
Instance=5
[5CPU]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=CPU
Counter=% Processor Time
Mode=DifferenceTotalPercent
Instance=5
[Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
Order=Working Set - Private
Filter=_Total|Rainmeter
UpdateDivider=#UpdDiv#
[1MemName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=name
Instance=1
[1Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=Working Set - Private
Instance=1
[2MemName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=name
Instance=2
[2Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=Working Set - Private
Instance=2
[3MemName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=name
Instance=3
[3Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=Working Set - Private
Instance=3
[4MemName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=name
Instance=4
[4Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=Working Set - Private
Instance=4
[5MemName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=name
Instance=5
[5Mem]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=Mem
Counter=Working Set - Private
Instance=5
[IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
Order=IO Data Bytes/sec
Filter=_Total|Rainmeter
Mode=Difference
[1IODataName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=name
Instance=1
[1IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=IO Data Bytes/sec
Mode=Difference
Instance=1
[2IODataName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=name
Instance=2
[2IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=IO Data Bytes/sec
Mode=Difference
Instance=2
[3IODataName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=name
Instance=3
[3IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=IO Data Bytes/sec
Mode=Difference
Instance=3
[4IODataName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=name
Instance=4
[4IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=IO Data Bytes/sec
Mode=Difference
Instance=4
[5IODataName]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=name
Instance=5
[5IOData]
Measure=Plugin
Plugin=Plugins\NomFerp.dll
ParentName=IOData
Counter=IO Data Bytes/sec
Mode=Difference
Instance=5
; lua List Processor
[MeasureProcs]
Measure=Script
ScriptFile=Process.lua
UpdateDivider=#UpdDiv#
.................................................................................................................................................................
[Backdrop]
Meter=Image
;SolidColor=#ColorCplB#99
X=25
Y=0
W=1050
H=112
DynamicVariables=1
[MeterCProcsV]
Meter=STRING
Text=#CValues#
FontFace=#FontName#
FontColor=#ColorCplB#
FontSize=(#FontSize#-2)
;StringEffect=Border
FontEffectColor=#ColorCplA#
AntiAlias=1
StringAlign=RightBottom
StringStyle=Bold
X=845
Y=230
DynamicVariables=1
[MeterCProcsN]
Meter=STRING
Text=#CNames#
FontFace=#FontName#
FontColor=#ColorMain#
FontSize=(#FontSize#-2)
StringEffect=Shadow
FontEffectColor=#ColorShade#
AntiAlias=1
StringAlign=RightBottom
X=800
Y=230
DynamicVariables=1
[MeterMProcsV]
Meter=STRING
Text=#MValues#
FontFace=#FontName#
FontColor=#ColorCplB#
FontSize=(#FontSize#-2)
;StringEffect=Border
FontEffectColor=#ColorCplA#
AntiAlias=1
StringAlign=RightBottom
StringStyle=Bold
X=615
Y=230
DynamicVariables=1
[MeterMProcsN]
Meter=STRING
Text=#MNames#
FontFace=#FontName#
FontColor=#ColorMain#
FontSize=(#FontSize#-2)
StringEffect=Shadow
FontEffectColor=#ColorShade#
AntiAlias=1
StringAlign=LeftBottom
X=625
Y=230
DynamicVariables=1
[MeterDProcsV]
Meter=STRING
Text=#DValues#
FontFace=#FontName#
FontColor=#ColorCplB#
FontSize=(#FontSize#-2)
;StringEffect=Border
FontEffectColor=#ColorCplA#
AntiAlias=1
StringAlign=RightBottom
StringStyle=Bold
X=155
Y=230
DynamicVariables=1
[MeterDProcsN]
Meter=STRING
Text=#DNames#
FontFace=#FontName#
FontColor=#ColorMain#
FontSize=(#FontSize#-2)
StringEffect=Shadow
FontEffectColor=#ColorShade#
AntiAlias=1
StringAlign=RightBottom
X=125
Y=230
DynamicVariables=1
Lemme tell you. Process name beautification, and implementation of visible thresholds.
Code: Select all
function Initialize()
sIncPath = SKIN:GetVariable("CURRENTPATH") .. "ProcessName.inc"
tProcessName = ReadIni(sIncPath)
sSectionName = "ProcessName"
end -- function Initialize
function Update()
-- Fetch & Process Data
local vC, vM, vD, tC, tM, tD = FixCounters()
local nC, nM, nD = FixNames(tC, tM, tD)
-- Import into Rainmeter
SKIN:Bang("!SetVariable CNames \"" .. nC .. "\"")
SKIN:Bang("!SetVariable MNames \"" .. nM .. "\"")
SKIN:Bang("!SetVariable DNames \"" .. nD .. "\"")
SKIN:Bang("!SetVariable CValues \"" .. vC .. "\"")
SKIN:Bang("!SetVariable MValues \"" .. vM .. "\"")
SKIN:Bang("!SetVariable DValues \"" .. vD .. "\"")
return
end -- function Update
function FixNames(tC, tM, tD)
-- Get data from measures
local sCNameO = {}
local sMNameO = {}
local sDNameO = {}
local sCNameV = {}
local sMNameV = {}
local sDNameV = {}
local sAllNameV = {}
local sCNameStacked = ""
local sMNameStacked = ""
local sDNameStacked = ""
for i = 1,5 do
-- Get the measures
sCNameO[i] = SKIN:GetMeasure('' .. i .. 'CPUName')
sMNameO[i] = SKIN:GetMeasure('' .. i .. 'MemName')
sDNameO[i] = SKIN:GetMeasure('' .. i .. 'IODataName')
-- Then their strings without spaces
sCNameV[i] = sCNameO[i]:GetStringValue()
sMNameV[i] = sMNameO[i]:GetStringValue()
sDNameV[i] = sDNameO[i]:GetStringValue()
sCNameV[i] = string.gsub(sCNameV[i],"%s","")
sMNameV[i] = string.gsub(sMNameV[i],"%s","")
sDNameV[i] = string.gsub(sDNameV[i],"%s","")
sCNameV[i] = string.gsub(sCNameV[i],"(.-)%#?%d?%d?","%1")
sMNameV[i] = string.gsub(sMNameV[i],"(.-)%#?%d?%d?","%1")
sDNameV[i] = string.gsub(sDNameV[i],"(.-)%#?%d?%d?","%1")
-- Combined to check for new processes
table.insert(sAllNameV, sCNameV[i])
table.insert(sAllNameV, sMNameV[i])
table.insert(sAllNameV, sDNameV[i])
-- Then go human readable
sCNameV[i] = sCNameV[i]:gsub("(.*)", tProcessName )
sMNameV[i] = sMNameV[i]:gsub("(.*)", tProcessName )
sDNameV[i] = sDNameV[i]:gsub("(.*)", tProcessName )
-- And stack
if tC >= i then sCNameStacked = sCNameStacked .. "\n" .. sCNameV[i] .. "\n" end
if tM >= i then sMNameStacked = sMNameStacked .. sMNameV[i] .. "\n\n" end
if tD >= i then sDNameStacked = sDNameStacked .. "\n".. sDNameV[i] .. "\n" end
end
-- Checking for new processes and write to file
for tIndex, sProcessName in pairs(sAllNameV) do
if tProcessName[sProcessName] == nil then
tProcessName[sProcessName] = sProcessName
WriteIni(sIncPath,sSectionName,sProcessName,"" .. sProcessName .. " ")
print("Added new process " .. sProcessName .. " to INC file")
end
end
-- Then return stacked strings...
return sCNameStacked, sMNameStacked, sDNameStacked
end
function FixCounters()
-- Get data from measures
local sCCtrO = {}
local sMCtrO = {}
local sDCtrO = {}
local sCCtrV = {}
local sMCtrV = {}
local sDCtrV = {}
local sCCtrT = 5
local sMCtrT = 5
local sDCtrT = 5
local sCCtrStacked = ""
local sMCtrStacked = ""
local sDCtrStacked = ""
for i = 1,5 do
-- Get the measures
sCCtrO[i] = SKIN:GetMeasure('' .. i .. 'CPU')
sMCtrO[i] = SKIN:GetMeasure('' .. i .. 'Mem')
sDCtrO[i] = SKIN:GetMeasure('' .. i .. 'IOData')
-- Then their values
sCCtrV[i] = (sCCtrO[i]:GetValue() )
sMCtrV[i] = (sMCtrO[i]:GetValue() )
sDCtrV[i] = (sDCtrO[i]:GetValue() )
-- And stack the rest
if sCCtrV[i] < 1 then
sCCtrT = sCCtrT - 1
else
sCCtrStacked = sCCtrStacked .. "\n" .. string.format("%4.1f", sCCtrV[i] ) .. "%\n"
end
if sMCtrV[i] < (48 * 1024 * 1024) then
sMCtrT = sMCtrT - 1
else
sMCtrStacked = sMCtrStacked .. AutoScale(sMCtrV[i]) .. "\n\n"
end
if sDCtrV[i] < (1024 * 10) then
sDCtrT = sDCtrT - 1
else
sDCtrStacked = sDCtrStacked .. AutoScale(sDCtrV[i]) .. "/s\n\n"
end
end
return sCCtrStacked, sMCtrStacked, sDCtrStacked, sCCtrT, sMCtrT, sDCtrT
end
function ReadIni(filename)
local f = io.open(filename,'r')
if not f then return nil, print("ReadIni: Can't open file: "..filename) end
local line_counter=0
local tablename = {}
local section
for fline in f:lines() do
line_counter=line_counter+1
-- Ignore leading and trailing spaces
local line = fline:match("^%s*(.-)%s*$")
-- Ignore comments
if not line:match("^[%;#]") and #line > 0 then
-- Check for [Section]
local sec = line:match("^%[(.*)%]$")
if sec then
section = sec
-- if not tablename[section] then tablename[section]={} end
else
-- parse Key=Value
local key, value = line:match("([^=]*)%=(.*)$")
-- Remove white space from Key=Value
key = key:match("^%s*(%S*)%s*$")
value = value:match("^%s*(.-)%s*$")
-- Check for error
if not (key and value) then return nil, print('Error bad key or value in file:'.. filename..': '.. line_counter.."\n line:".. fline) end
-- Set Section/Key/Value in table
if section then
if not tablename[key] then tablename[key]=value end
-- if not tablename[key][value] then tablename[key][value]={} end
end
end
end
end
f:close()
return tablename
end -- function ReadIni
function WriteIni(file,section,key,value)
local hFile=io.input(file,'r')
if not io.type(hFile)=='file' then
print('Cannot open file: '..file)
else
local Text=io.read('*all')
hFile=io.output(file,'w')
local NewText=string.gsub(Text,
'%['..section..']([^%[]+)',
function(a)
if string.match(a,'\n%s-'..key..'%s-=') then
a=string.gsub(a,'\n%s-'..key..'%s-=%s-([^;\n]+)','\n'..key..'='..value)
else
a=(string.match(a,'(.+)\n$') or '')..'\n'..key..'='..value..'\n'
end
return '['..section..']'..a
end
)
io.write(NewText)
io.close(hFile)
end
end -- function WriteIni
function Round(num, idp)
assert(tonumber(num), 'Round expects a number.')
local mult = 10 ^ (idp or 0)
if num >= 0 then
return math.floor(num * mult + 0.5) / mult
else
return math.ceil(num * mult - 0.5) / mult
end
end
function AutoScale(num)
assert(tonumber(num), 'AutoScale expects a number.')
local scales = {' B', 'kB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'}
local scale = ""
local scaled = 0
for i, v in ipairs(scales) do
if (num < (1024 ^ i)) or (i == #scales) then
scale = v
scaled = num / 1024 ^ (i - 1)
break
end
end
-- .. string.rep(" ", math.max((3 - string.len(scaled .. "")), 0))
return Round(scaled , math.max(2 - math.floor(math.log10(scaled + 0.01)),0)) .. " " .. scale
end
Code: Select all
[ProcessName]
3DVision=3DVision
7z=7-Zip Console
7za=7-Zip
7za.dll=7Za Dll
7zFM=7-Zip File Manager
7zG=7-Zip Gui
Acrobat=Acrobat
acrodist=Acrodist
adb=Android Debug Bridge
AdFender=AdFender
Ahk2Exe=Ahk2Exe
Essentially, ailia, thanks for not making me figure out a more convoluted way to get at my 'Identify Bottlenecks at a glace' rainmeter setup. Your plugin has been much appreciated.