It is currently September 8th, 2024, 12:06 am

Thread for help with the Shape meter

Get help with creating, editing & fixing problems with skins
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

The thing I still don't understand is that where are you getting the 0 or 1 from?
By measuring m#Total, you are measuring the size of the disk, which will never be 1 and the about window does not show a 1 in Range, Number or String, so how are you getting the 1?
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Just can't get this to work!
Tried using Conditional Formula on BAR meters X but also doesn't work. Do I need to have a Calc Measure for the formula to have an effect?
X=([m4Total]=0 ? 0 : 70)

The Meter just stays at zero, regardless of whether a drive is plugged in or not.
I'm totally lost on this! :oops:

I just don't get how to use the formula. Do I use it on a meter's X? But then how do I tell the meter's Measures to update?
If I use it on a Measure, do I use OnChangeAction? But then how do I use it specify the X?
Either way, one doesn't work.

This doesn't work on [m4Total]: OnChangeAction=#Bar4X#=(#Bar1X# + (#BarW# + 2) * Sgn([m1Total:]) + (#BarW# + 2) * Sgn([m2Total:]) + (#BarW# + 2) * Sgn([m3Total:]))[!ToggleMeterGroup "#Disk4#"][!ToggleMeasureGroup #Disk4#][!UpdateMeasureGroup #Disk4#][!UpdateMeterGroup #Disk4#][!UpdateMeter 4Used][!Redraw]
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Thread for help with the Shape meter

Post by Yincognito »

Sample for your original question, with logging (this will have BarD transparent pixels at the right if only empty drives follow):

Code: Select all

[Variables]
Epsilon=0.00001
BarBack=0,255,0,255
BarUsed=0,128,0,255
BarD=5
BarH=100
BarW=20
BarX=10
Disk1=C
Disk2=D
Disk3=
Disk4=F

[Rainmeter]
Update=1000
AccurateText=1
DynamicWindowSize=1

---Measures---

[m1Total]
Measure=FreeDiskSpace
Drive=#Disk1#:
Total=1
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m1Used]
Measure=FreeDiskSpace
Drive=#Disk1#:
Total=0
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m2Total]
Measure=FreeDiskSpace
Drive=#Disk2#:
Total=1
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m2Used]
Measure=FreeDiskSpace
Drive=#Disk2#:
Total=0
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m3Total]
Measure=FreeDiskSpace
Drive=#Disk3#:
Total=1
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m3Used]
Measure=FreeDiskSpace
Drive=#Disk3#:
Total=0
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m4Total]
Measure=FreeDiskSpace
Drive=#Disk4#:
Total=1
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

[m4Used]
Measure=FreeDiskSpace
Drive=#Disk4#:
Total=0
IgnoreRemovable=0
RegExpSubstitute=1
Substitute="^(.+)$":"\1B","0\.00 B":""
DynamicVariables=1

---Meters---

[DiskBars]
Meter=Shape
Shape =Rectangle (#BarX#+(#BarW#+#BarD#)*(0                                                )),0,([m1Total:]=0?0:#BarW#),(#BarH#                                 ) | StrokeWidth 0 | Fill Color #BarBack#
Shape2=Rectangle (#BarX#+(#BarW#+#BarD#)*(0                                                )),0,([m1Total:]=0?0:#BarW#),(#BarH#*[m1Used:]/([m1Total:]+#Epsilon#)) | StrokeWidth 0 | Fill Color #BarUsed#
Shape3=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])                                )),0,([m2Total:]=0?0:#BarW#),(#BarH#                                 ) | StrokeWidth 0 | Fill Color #BarBack#
Shape4=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])                                )),0,([m2Total:]=0?0:#BarW#),(#BarH#*[m2Used:]/([m2Total:]+#Epsilon#)) | StrokeWidth 0 | Fill Color #BarUsed#
Shape5=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])+Sgn([m2Total:])                )),0,([m3Total:]=0?0:#BarW#),(#BarH#                                 ) | StrokeWidth 0 | Fill Color #BarBack#
Shape6=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])+Sgn([m2Total:])                )),0,([m3Total:]=0?0:#BarW#),(#BarH#*[m3Used:]/([m3Total:]+#Epsilon#)) | StrokeWidth 0 | Fill Color #BarUsed#
Shape7=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])+Sgn([m2Total:])+Sgn([m3Total:]))),0,([m4Total:]=0?0:#BarW#),(#BarH#                                 ) | StrokeWidth 0 | Fill Color #BarBack#
Shape8=Rectangle (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])+Sgn([m2Total:])+Sgn([m3Total:]))),0,([m4Total:]=0?0:#BarW#),(#BarH#*[m4Used:]/([m4Total:]+#Epsilon#)) | StrokeWidth 0 | Fill Color #BarUsed#
UpdateDivider=-1
OnUpdateAction=[!Log "Bar 4 X = (#BarX#+(#BarW#+#BarD#)*(0+Sgn([m1Total:])+Sgn([m2Total:])+Sgn([m3Total:])))"]
DynamicVariables=1
sl23 wrote: July 14th, 2024, 8:25 pm The thing I still don't understand is that where are you getting the 0 or 1 from?
By measuring m#Total, you are measuring the size of the disk, which will never be 1 and the about window does not show a 1 in Range, Number or String, so how are you getting the 1?
Look for Sgn(x) at https://docs.rainmeter.net/manual/formulas/ in the manual. Or, if you like it better, find why at https://en.wikipedia.org/wiki/Sign_function if curious.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Thanks for that. I already looked at the manual, but didn't understand. I've just searched the web for it and found the wiki page you linked to. Then just found your link! :lol:
It makes sense now. :thumbup:
Apart from the Epsilon, what's that? I don't get the explanations online, can't actually see anything that tells what it's for.

When it comes to using that Conditional formula, is there a reason that wouldn't work as I'd expected on the meters X position?
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

One last thing, though related to bar meters, why is it this works for the String meters but not the Bar meters?
String: X=([m#CurrentSection#Total:]=0 ? 0 : #BarW#+2)r Works.
Bar: X=([m#CurrentSection#Total:]=0 ? 0 : #BarW#+2)r Fails, moves all bars to X=0.
Bar: X=([m#CurrentSection#:]=0 ? 0 : #BarW#+2)r Fails, needs a skin refresh.
Section names are correct btw.
DiskBar.gif
You do not have the required permissions to view the files attached to this post.
57686174 77696C6C 6265 77696C6C 6265
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Realised what the issue is, though I don't know if I can solve it or it's possible to do it as simply as I'm hoping.
I need to measure m#Total and that's the problem.

I'm using this and want to know if I can somehow replace the number, or # above, with a wildcard?

At present, I'm using: Hidden=([m#CURRENTSECTION#Total:]=0 ? 1 : 0) for the text, ie, drive letters in MeterStyle.
I'm using a similar thing for the Bar meters, but it won't work as the Section name isn't a simple number, it is [#Used], so I need a wildcard in place of the number or #CURRENTSECTION# in this case. Can I do that?
57686174 77696C6C 6265 77696C6C 6265
User avatar
ikarus1969
Posts: 588
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Thread for help with the Shape meter

Post by ikarus1969 »

sl23 wrote: July 16th, 2024, 10:31 am Realised what the issue is, though I don't know if I can solve it or it's possible to do it as simply as I'm hoping.
I need to measure m#Total and that's the problem.

I'm using this and want to know if I can somehow replace the number, or # above, with a wildcard?

At present, I'm using: Hidden=([m#CURRENTSECTION#Total:]=0 ? 1 : 0) for the text, ie, drive letters in MeterStyle.
I'm using a similar thing for the Bar meters, but it won't work as the Section name isn't a simple number, it is [#Used], so I need a wildcard in place of the number or #CURRENTSECTION# in this case. Can I do that?
Do i understand you right: you have the line Hidden=([m#CURRENTSECTION#Total:]=0 ? 1 : 0) and want to replace the #CURRENTSECTION# by some other measure which gives you the correct number, eg. 1 or 2 or 3, or...? Is that right?

If your answer is "yes", you need a either a measure or a variable which holds the correct number you want. For this example, i assume there is a measure which gives you the correct number. Let's say:

Code: Select all

[Measure_number]
Measure=CALC
Formula=2  <-- please replace it by whatever is necessary to get the number you want
DynamicVariables=1
then, in your code for the hidden-property you can code as:
Hidden=([&m[&Measure_number]Total:]=0 ? 1 : 0)

If it's not a measure that holds the number you want but a variable you would code:
Hidden=([&m[#variable_with_the__number]Total:]=0 ? 1 : 0)

For this specific example, the hidden-property will evaluate to: Hidden=([&m2Total:]=0 ? 1 : 0)
If all my assumptions are true, can you give it a try?

In the docu you can read about it here: https://docs.rainmeter.net/manual/variables/nesting-variables/

a short test-skin for demonstrating nesting variables:

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
SkinWidth=140
SkinHeight=100
BackgroundMode=2
SolidColor=00408040

[Variables]
nbr=0
color1=0,64,128
color2=128,0,0
color3=0,128,0
color4=190,200,0

[loop1abc]
Measure=loop
StartValue=1
EndValue=4
OnUpdateAction[!SetVariable "nbr" "[&llop1abc]"]
DynamicVariables=1


[ABC1TOTAL]
Measure=CALC
Formula=1

[ABC2TOTAL]
Measure=CALC
Formula=2

[ABC3TOTAL]
Measure=CALC
Formula=3

[ABC4TOTAL]
Measure=CALC
Formula=4


[StringMeter]
Meter=STRING
Text=Color [&ABC[&loop1abc]TOTAL]
X=10
Y=10
FontColor=FFFFFF
Padding=20,20,20,20
SolidColor=[#color[&ABC[&loop1abc]TOTAL]]
AntiAlias=1
DynamicVariables=1
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Yes you are correct, thanks for your help :thumbup:

I was thinking of using Variables, I just wondered if there were a way of doing it using a wildcard as I described. But I assume there's not. Shame really, would've made things a lot simpler. :)

I just noticed the & character, why have you added that? Is it necessary to work correctly? After evaluation Hidden=([&m2Total:]=0 ? 1 : 0) why the &?
57686174 77696C6C 6265 77696C6C 6265
User avatar
ikarus1969
Posts: 588
Joined: February 28th, 2011, 3:20 pm
Location: Vienna, Austria

Re: Thread for help with the Shape meter

Post by ikarus1969 »

I admit, i don't understand what you mean with "wildcard" in this context, but i wish you the best for your skin!
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Thread for help with the Shape meter

Post by sl23 »

Ok no problem, thanks :thumbup:

From Wikipedia:
In software, a wildcard character is a kind of placeholder represented by a single character, such as an asterisk, which can be interpreted as a number of literal characters or an empty string. It is often used in file searches so the full name need not be typed.
57686174 77696C6C 6265 77696C6C 6265