It is currently April 18th, 2024, 10:35 pm

Need help with data counter

Get help with creating, editing & fixing problems with skins
utg001
Posts: 4
Joined: May 5th, 2018, 4:59 pm

Need help with data counter

Post by utg001 »

I've been banging my head over this for a few months now to no avail, Please load up (a small portion of) my skin to see what I'm on about. Down is the total internet usage for downloading you have used, Session is initially supposed to show same stats as Down and reset to zero when you leftclick the skin. Please help me figure out whats wrong...

Code: Select all

[Rainmeter]
Update=100
AccurateText=1
LeftMouseDownAction=!RainmeterSetVariable sss usage
;RightMouseDownAction=!RainmeterResetStats
[TextStyle]
FontFace=Segoe UI
FontSize=13
FontColor=255,255,255,255
AntiAlias=1
[Variables]
usage=MeasureNetIn
sss=0
[MeasureNetSession]
Measure=Calc
Formula=usage-sss
[MeasureNetIn]
Measure=NetIn
Cumulative=1
[MeterNetText5]
Meter=String
MeasureName=MeasureNetIn
X=0
Y=0
W=150
H=50
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
cumulative=1
Text=Down   : %1B
[MeterNetSession]
Meter=String
MeasureName=MeasureNetSession
X=0
Y=30
W=150
H=50
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
cumulative=1
Text=Session : %1B
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with data counter

Post by balala »

utg001 wrote:Please help me figure out whats wrong...
usage and sss (used into the [MeasureNetSession] measure) are variables and unlike in programming languages, in Rainmeter the variables have to be included between # signs. So replace the Formula option of this measure, with: Formula=[color=#FF0000]#[/color]usage[color=#FF0000]#[/color]-[color=#FF0000]#[/color]sss[color=#FF0000]#[/color].
Also, because the sss variable is set up by a !SetVariable (!RainmeterSetVariable - see below) bang, the measure using it should have to have added a DynamicVariables=1 option. So, add it to the [MeasureNetSession] measure.

And a few more tips:
  • The !Rainmeter... bang prefix is deprecated. Remove it. Eg the ![color=#FF0000]Rainmeter[/color]SetVariable sss usage bang (incorrectly - see below) used into the [Rainmeter] section should have to be !SetVariable sss usage (but this is still not complete - see below).
  • Due to the same reason as above, the usage variable used into the above LeftMouseDownAction should have to be included into # signs: LeftMouseDownAction=!SetVariable sss #usage#.
  • But this is still not enough: #usage# is in fact the name of a measure, which returns a numeric value. This can be used normally only in Formula or in IfCondition oiptions. So, there is one more thing you should have to add to the above option - brackets: LeftMouseDownAction=[!SetVariable sss "[#usage#]"]. Here I also added quotations and brackets around the whole bang - although the brackets aren't absolutely needed in such cases (when there is one single bang), it seems a good habit to use them.
  • Usually instead of LeftMouseDownAction option you should have to use LeftMouseUpAction. Here you can find out why.
  • In spite of all these, I'm not sure the above LeftMouseDownAction (or LeftMouseUpAction option will always work, because as it is written, the dynamic variables would be needed, but they can't be used into the [Rainmeter] section.
  • Why have you set the Update to 100? I think the default Update=1000 would be better and enough. Usually if for any reason a lower Update isn't required, the default value is better.
utg001
Posts: 4
Joined: May 5th, 2018, 4:59 pm

Re: Need help with data counter

Post by utg001 »

balala wrote:And a few more tips...
Thank you so much for your time, I was trying to make my own skin because I couldn't find any specific to my taste. The update time is set to 100 because I have some graphs in my skin that look bad with 1s update time. I'm happy with my skin -for now- perhaps I'll add more features later on. Please do check it out and see if there is room for improvements...

Code: Select all

[Rainmeter]
Update=100
AccurateText=1
LeftMouseDoubleClickAction=[!SetVariable sss "[#usage#]"]
[Variables]
usage=MeasureNetIn2
sss=0
[TextStyle]
FontFace=Segoe UI
FontSize=13
FontColor=255,255,255,255
AntiAlias=1

[MeasureCoreTemp]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=MaxTemperature
MaxValue=110
AverageSize=100

[CPUTempLine]
Meter=Line
MeasureName=MeasureCoreTemp
X=0r
Y=0r
H=100
W=1050
LineColor=255,105,105,255
LineWidth=2
Padding=1,0,0,0
AntiAlias=1

[CPUTemp]
Meter=STRING
MeasureName=MeasureCoreTemp
X=1050
Y=65
MeterStyle=TextStyle
FontSize=20
StringStyle=NORMAL
Text=%1°C

[MeasureCPU]
Measure=CPU
AverageSize=100

[CPUsageLine]
Meter=Line
MeasureName=MeasureCPU
averagesize=1000
X=0
Y=0
H=100
W=1050
LineCount=1
LineColor=173,173,173,255
Padding=1,0,0,0
AntiAlias=1

[CPUUsageLine2]
Meter=Histogram
MeasureName=MeasureCPU
averagesize=1000
X=0r
Y=0r
H=100
W=1050
PrimaryColor=173,173,173,50
Padding=1,0,0,0
AntiAlias=1

[CPUUsage]
Meter=STRING
MeasureName=MeasureCPU
X=1125
Y=65
MeterStyle=TextStyle
FontSize=20
StringStyle=NORMAL
Text=%1%

[MeasureCpuSpeed]
Measure=Plugin
Plugin=CoreTemp
CoreTempType=CpuSpeed
AverageSize=100

[CPUSpeed]
Meter=STRING
MeasureName=MeasureCpuSpeed
X=1200
Y=55
MeterStyle=TextStyle
FontSize=25
StringStyle=NORMAL
StringAlign=Left
NumOfDecimals=3
Scale=1000
Text=%1 GHz

;Net speed stats
[MeasureNetIn]
Measure=NetIn
[MeasureNetOut]
Measure=NetOut
[Val]
Measure=Calc
Formula=1024
[Val2]
Measure=Calc
Formula=MeasureNetIn*10
AverageSize=100
[MeasureIN]
Measure=Calc
Formula=Val > [Val2] ? 0 : Val2
DynamicVariables=1
[Val3]
Measure=Calc
Formula=1024
[Val4]
Measure=Calc
Formula=MeasureNetOut*10
AverageSize=100
[MeasureOUT]
Measure=Calc
Formula=Val3 > [Val4] ? 0 : Val4
DynamicVariables=1

[Netline]
Meter=Line
MeasureName=MeasureIN
MeasureName2=MeasureOUT
X=0
Y=0
H=100
W=1050
LineCount=2
Autoscale=1
LineColor=105,255,105,255
LineColor2=105,105,255,255
LineWidth=2
Padding=1,0,0,0
AntiAlias=1

[MeterNetText]
Meter=String
updatedivider=10
MeasureName=MeasureIN
X=1350
Y=0
W=100
H=20
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"

[MeterNetText2]
Meter=String
updatedivider=10
MeasureName=MeasureOUT
X=1350
Y=20
W=100
H=20
StringAlign=right
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="%1Bps"


[MeterNetText3]
Meter=String
MeasureName=MeasureNetOut
X=1230
Y=20
W=100
H=20
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="Out :"
[MeterNetText4]
Meter=String
MeasureName=MeasureNetIn
X=1230
Y=0
W=100
H=20
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
Text="In    :"

;Net usage stats
[MeasureNetIn2]
Measure=NetIn
Cumulative=1

[MeasureNetOut2]
Measure=NetOut
Cumulative=1

[MeterNetText5]
Meter=String
MeasureName=MeasureNetIn2
X=1053
Y=0
W=100
H=50
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
cumulative=1
Text=Down    : %1B

[MeterNetText6]
Meter=String
MeasureName=MeasureNetOut2
X=1052
Y=20
W=100
H=50
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
cumulative=1
Text=Up         : %1B

[MeasureNetSession]
Measure=Calc
DynamicVariables=1
Formula=#usage#-#sss#
[MeterNetSession]
Meter=String
MeasureName=MeasureNetSession
X=1051
Y=40
W=150
H=50
MeterStyle=TextStyle
NumOfDecimals=2
AutoScale=1
cumulative=1
Text=Session  : %1B

[MeasureUptime]
Measure=Uptime
Format="%4!i! : %3!i!:%2!i!:%1!i!"

[MeterUptime]
Meter=String
MeasureName=MeasureUptime
FontSize=12
X=1190
Y=40
FontColor=255,255,255,255
Padding=5,5,5,5
AntiAlias=1
Text="Uptime    %1"
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Need help with data counter

Post by balala »

utg001 wrote:The update time is set to 100 because I have some graphs in my skin that look bad with 1s update time.
I'm not sure where are they, I couldn't find them, but anyway, I'd add a DefaultUpdateDivider=10 to the [Rainmeter] section. Due to this option, each measure and meter would be updated once per second (Update x DefaultUpdateDivider = 100 x 10 = 1000 ms = 1 s). Then I'd add the UpdateDivider=1 to each measure / meter involved into the animation. This way these sections would be updated with the set update period of the skin, of a tenth of second (Update x UpdateDivider = 100 x 1 = 100 ms).
There's no need to update most measures and meters so often, so you can save this way some resources.