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

Some questions RE: Shape Bar 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

Some questions RE: Shape Bar meter

Post by sl23 »

I'm trying to use shape meters as Bar meters. I searched the forum but can't seem to find anything as the search ignores the word 'bar.'

I've managed to get this working in many other skins using similar methods to this. but getting it to work with disks is proving to be a pita.
Not even the ToolTip wants to work! I can get tooltips working perfectly on the actual drive letter meter [1] in this case. But I was trying to get it working generically for all drives on the Shape meter. Though I think maybe this isn't possible? But it works as is so that I'm happy with.

Sort of unrelated, I am also struggling with nested variables. I don't know how these work, what the proper syntax is to use them so am stumbling around trying a million variations. I've looked at the manual, but there isn't much info on these, unless I missed a page?

I assume a nested variable is something like this: #Disk#CurrentSection##? But I'm stumped as to what the correct way to do it is and why. I remember death.crafter trying to help with this before, but don't know how to 'merge' two variables. I'm trying to get #CurrentSection# to replace the 1 in #Disk1#.
I made a note of this from that post:
Do not make a habit of using [##CURRENTSECTION#].
Use [#[#CURRENTSECTION]] instead.
But can't find it now and not sure he explained the reasons, or how or why to use nested variables.

Code: Select all

[Variables]
BarW=3
BarH=44
Disk1=C

[sAllText]
FontFace=Trebuchet MS
StringStyle=Bold
StringAlign=CenterCenter
FontSize=9
FontColor=#White#
AntiAlias=1
DynamicVariables=1
X=14r
Y=r
MeasureName=m#CurrentSection#Free
MeasureName2=m#CurrentSection#Total
MeasureName3=m#CurrentSection#Label
ToolTipIcon=Info
ToolTipTitle=%3:
ToolTipText=%1 / %2

[DiskBars]
Meter=Shape
Shape2=Rectangle   0, 0, #BarW#, ([m1Used]*#BarH#/100) | StrokeWidth 0 | Extend Fill2
DynamicVariables=1

[1]
Meter=String
MeterStyle=sAllText
Text=#Disk1#
Group=#Disk1#
X=6r
Y=38
I think the calc is wrong, but for some reason, it won't work for disks, but works with everything else I've tried it on. What am I doing wrong?

Any advice or info would be great, thanks. :thumbup:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Some questions RE: Shape Bar meter

Post by Yincognito »

Regarding why it doesn't work: the info / code you provided is insufficient, but in your Shape meter you start from Shape2. This won't work, you have to have an uninterrupted indexing on the said options, starting with Shape, e.g.:

Code: Select all

[SomeMeter]
Meter=Shape
Shape=...
Shape2=...
Shape3=...
...
Regarding nested syntax, what you're looking for is [#Disk[#CurrentSection]]. Basically, you'd replace all instances of #SomeVariable# with [#SomeVariable] and all instances of [SomeMeasure] with [&SomeMeasure] in what you reference, when it comes to the nested syntax. Obviously, you'd have to have DynamicVariables=1 added wherever you refer to #CURRENTSECTION#.
Profiles: Rainmeter ProfileDeviantArt ProfileSuites: MYiniMeterSkins: Earth
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5502
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Some questions RE: Shape Bar meter

Post by eclectic-tech »

Besides Yincognito's reply, here are a few other ideas...
sl23 wrote: July 12th, 2024, 6:21 pm I'm trying to use shape meters as Bar meters. I searched the forum but can't seem to find anything as the search ignores the word 'bar.'
Look at this post: https://forum.rainmeter.net/viewtopic.php?t=33215
sl23 wrote: July 12th, 2024, 6:21 pm I've managed to get this working in many other skins using similar methods to this. but getting it to work with disks is proving to be a pita.
Not even the ToolTip wants to work! I can get tooltips working perfectly on the actual drive letter meter [1] in this case. But I was trying to get it working generically for all drives on the Shape meter. Though I think maybe this isn't possible? But it works as is so that I'm happy with.
Add SolidColor=0,0,0,1 to your [AllText] style; this allows the mouse to detect the entire string meter area, without that setting, the mouse must be over the visible letter in the string meter.
sl23 wrote: July 12th, 2024, 6:21 pm Sort of unrelated, I am also struggling with nested variables. I don't know how these work, what the proper syntax is to use them so am stumbling around trying a million variations. I've looked at the manual, but there isn't much info on these, unless I missed a page?

I assume a nested variable is something like this: #Disk#CurrentSection##? But I'm stumped as to what the correct way to do it is and why. I remember death.crafter trying to help with this before, but don't know how to 'merge' two variables. I'm trying to get #CurrentSection# to replace the 1 in #Disk1#.
I made a note of this from that post:

But can't find it now and not sure he explained the reasons, or how or why to use nested variables.
The nested syntax would be [#Disk[#CurrentSection]], so if the #CurrentSection# is [1] this syntax will resolve to nested variable [#Disk1] which is the same as the standard variable #Disk1#.
sl23 wrote: July 12th, 2024, 6:21 pm I think the calc is wrong, but for some reason, it won't work for disks, but works with everything else I've tried it on. What am I doing wrong?

Any advice or info would be great, thanks. :thumbup:
You did not show your measures, so it is difficult to tell what calc you are referring to. It should resolve to the percentage of used disk space divided by total disk space, then that value times 100 times the shape height.
User avatar
sl23
Posts: 1600
Joined: February 17th, 2011, 7:45 pm
Location: a Galaxy S7 far far away

Re: Some questions RE: Shape Bar meter

Post by sl23 »

Yincognito wrote: July 12th, 2024, 8:05 pm Regarding why it doesn't work: the info / code you provided is insufficient, but in your Shape meter you start from Shape2. This won't work, you have to have an uninterrupted indexing on the said options, starting with Shape, e.g.:

Code: Select all

[SomeMeter]
Meter=Shape
Shape=...
Shape2=...
Shape3=...
...
Regarding nested syntax, what you're looking for is [#Disk[#CurrentSection]]. Basically, you'd replace all instances of #SomeVariable# with [#SomeVariable] and all instances of [SomeMeasure] with [&SomeMeasure] in what you reference, when it comes to the nested syntax. Obviously, for you'd have to have DynamicVariables=1 added wherever you refer to #CURRENTSECTION#.
Thanks for your help again :thumbup:
Yeah, sorry, you know what I'm like! I didn't think to explain about the shape2=... as it was just part of the whole. There are in fact 10 shapes at present. background1, bar1, background2 ,bar2, etc. So that part is correct. I do have DynamicVariables=1 too.

So given that I have it correct, why is that not measuring the disk usage correctly? I know the code works with bars as it's been adapted from previous code that works fine. It's just that I don't know how the formula works for getting the correct Height of the Shape2 meter. I'm not getting a percentage value in the About window, though I read that you do get that when it's applied to a meter from the manual. So now I have no idea what I am dealing with and how to create a formula that works. Everything I've put in does nothing.

So this is for Disk C:
[DiskBars]
Meter=Shape
Shape=Rectangle 0, 0, #BarW#, #BarH# | StrokeWidth 0 | Extend Fill1
Shape2=Rectangle 0, 0, #BarW#, ([m1Used]*#BarH#/100) | StrokeWidth 0 | Extend Fill2

m1Used is giving the full value of used space as a number and a string. But I read earlier today that it is somehow converted to percentage when used in a meter. Maybe I got that wrong? But this is the problem ([m1Used]*#BarH#/100).



Re: nested variables, I was sure I tried that, must've gotten it wrong!
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: Some questions RE: Shape Bar meter

Post by sl23 »

Omg thanks eclectic-tech! :thumbup:
Are these pages linked in the manual at all?

I'm not having an issue with the tips appearing over the non visible part of text, strangely. Just with the shape meter, never had that problem before, so weird! But it's ok, I'll keep that as is.

I'll give that formula a try. Thank you :D

Here are all the measures for disk 1:
As I said, it should all work ok as I've been using this in my TaskBar skins suite that I recently posted.

Code: Select all

[m1Label]
Measure=FreeDiskSpace
Drive=#Disk1#:
UpdateDivider=-1
Label=1
Group=#Disk1#

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

[m1Used]
Measure=FreeDiskSpace
Drive=#Disk1#:
IgnoreRemovable=0
InvertMeasure=1
Group=#Disk1#

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

IfCondition=(m1Total=0)
IfTrueAction=[!SetOption DiskBg1 X "0r"] [!HideMeterGroup "#Disk1#"] [!DisableMeasureGroup #Disk1#] [!UpdateMeterGroup #Disk1#][!Redraw]
IfFalseAction=[!SetOption DiskBg1 X "67"] [!ShowMeterGroup "#Disk1#"] [!EnableMeasureGroup #Disk1#][!UpdateMeterGroup #Disk1#][!Redraw]

[mDiskRead1]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=Disk Read Bytes/sec
Name=#Disk1#:
Group=#Disk1#

[mDiskWrite1]
Measure=Plugin
Plugin=UsageMonitor
Category=LogicalDisk
Counter=Disk Write Bytes/sec 
Name=#Disk1#:
Group=#Disk1#

IfCondition=((mDiskRead1=0)&&(mDiskWrite1=0))
IfTrueAction=[!SetOption 1Label FontColor "#DiskNorm#"] [!UpdateMeter "1Label"] [!Redraw]
IfCondition2=((mDiskRead1>0)&&(mDiskWrite1=0))
IfTrueAction2=[!SetOption 1Label FontColor "#DiskRead#"] [!UpdateMeter "1Label"] [!Redraw]
IfCondition3=((mDiskRead1=0)&&(mDiskWrite1>0))
IfTrueAction3=[!SetOption 1Label FontColor "#DiskWrite#"] [!UpdateMeter "1Label"] [!Redraw]
IfCondition4=((mDiskRead1>0)&&(mDiskWrite1>0))
IfTrueAction4=[!SetOption 1Label FontColor "#DiskBoth#"] [!UpdateMeter "1Label"] [!Redraw]
EDIT: @eclectic-tech:
From your post I got this, is it correct?
(used disk space / total disk space) x 100 x shape height.
Shape2=Rectangle 0, 0, #BarW#, (([m1Used]/[m1Total])*100*#BarH#) | StrokeWidth 0 | Extend Fill2

I just get an empty bar using that.
When I use a calculator to work it out, I get 1,327.913290631359 not a percentage for the shape meter to use, which I suppose is what is needed? I'm expecting the shape meter bar to fill approx 26/27%, but it's empty.

EDIT:
Oh damn! I just realised that as this is a vertical meter, you have to put a negative Height value in or the meter goes down. That could be what is affecting the values?

Perhaps I should stick to using bar meters! Uses less CPU anyway! :lol:
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Some questions RE: Shape Bar meter

Post by Yincognito »

sl23 wrote: July 12th, 2024, 9:00 pm(used disk space / total disk space) x 100 x shape height
[...]
Oh damn! I just realised that as this is a vertical meter, you have to put a negative Height value in or the meter goes down. That could be what is affecting the values?
For up to down fill direction: (used disk space / total disk space x shape height)
For down to up fill direction: (shape height - used disk space / total disk space x shape height) or (shapeheight x (1 - - used disk space / total disk space))

You said you were good at math... :???:

That being said, you should make sure the measure is returning numbers, i.e. [m1Total:]
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: Some questions RE: Shape Bar meter

Post by sl23 »

Thanks, yet again! :oops: :thumbup:

Didn't I say that I WAS good at math? :confused: :rolmfao:

I am, but again, use it or lose it! I haven't used formulas for around 33 years! O.O
57686174 77696C6C 6265 77696C6C 6265
User avatar
Yincognito
Rainmeter Sage
Posts: 8030
Joined: February 27th, 2015, 2:38 pm
Location: Terra Yincognita

Re: Some questions RE: Shape Bar meter

Post by Yincognito »

sl23 wrote: July 12th, 2024, 9:58 pm Thanks, yet again! :oops: :thumbup:
Both directions present:

Code: Select all

[Variables]
BarW=20
BarH=100
Disk1=D

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

---Measures---

[m1Used]
Measure=FreeDiskSpace
Drive=#Disk1#:
IgnoreRemovable=0
InvertMeasure=1
Group=#Disk1#

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

---Meters---

[Result]
Meter=Shape
Shape=Rectangle 0, 0, #BarW#, #BarH# | StrokeWidth 0 | Fill Color 0,0,0,255
Shape2=Rectangle 0, 0, #BarW#, ([m1Used:]/[m1Total:]*#BarH#) | StrokeWidth 0 | Fill Color 255,0,0,255
;Shape2=Rectangle 0, (#BarH#-[m1Used:]/[m1Total:]*#BarH#), #BarW#, ([m1Used:]/[m1Total:]*#BarH#) | StrokeWidth 0 | Fill Color 255,0,0,255
UpdateDivider=-1
DynamicVariables=1
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: Some questions RE: Shape Bar meter

Post by sl23 »

Um, that didn't work: (shape height - used disk space / total disk space x shape height). Tried setting BarH= -44 and to BarH=44.
Shape2=Rectangle 0, 0, #BarW#, (#BarH#-[m1Used]/[m1Total]*#BarH#) | StrokeWidth 0 | Extend Fill2

Again, this doesn't work either: (shapeheight x (1 - - used disk space / total disk space)). Again tried both BarH=-44 and BarH=44.
Shape2=Rectangle 0, 0, #BarW#, (#BarH#*(1-[m1Used]/[m1Total]*#BarH#)) | StrokeWidth 0 | Extend Fill2
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: Some questions RE: Shape Bar meter

Post by sl23 »

Yincognito wrote: July 12th, 2024, 9:54 pm That being said, you should make sure the measure is returning numbers, i.e. [m1Total:]
Damn! Just saw this! Forgot to add that in :lol:
57686174 77696C6C 6265 77696C6C 6265