It is currently April 23rd, 2024, 8:49 pm

ToolTips and Measures

Get help with installing and using Rainmeter.
LCA
Posts: 2
Joined: August 24th, 2014, 6:34 pm

ToolTips and Measures

Post by LCA »

Hello everybody! I have a little problem with a skin I am creating. The skin is just a button that empty the recycle bin and shows the elements and the size of the bin as a tooltip.

my problem is that i can't fit two measure in the tooltip. the text is the following

Code: Select all

[Rainmeter]
Update=1000

[Metadata]
Name=EmptyRecBin

[measureBinItems]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=COUNT
UpdateDivider=3

[measureBinSize]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=SIZE
UpdateDivider=3


[MeterEmpty]
Meter=Button
ButtonImage=ButtonBitmap.png
ButtonCommand=!Execute [!PluginBang "measureBinItems EmptyBin"]

MeasureName=measureBinItems
MeasureName2=measureBinSize
MouseOverAction=[!SetOption MeterText Text "Mouse OVER state"][!UpdateMeter MeterText][!Redraw]

ToolTipType=1
ToolTipText=%1 element(s), %2 B
AutoScale=1

in the last section i use two "measurename", but only the first one is recognisez as a measure (whether it is size or items).

is there a solution?
thanks
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ToolTips and Measures

Post by jsmorley »

The problem is that the Button meter only supports one MeasureName=, and doesn't support MeasureName2, MeasureName3, ect., and therefore no %2, %3 etc. You can easily solve this with SectionVariables in the Tooltip.

The only real issue is that AutoScale never works in the context of a Toolip... It only works in the context of the Text option on a String meter. This is mostly due to the fact that AutoScale is pointless without the automatic "k,M,G,T" postfix on the end of it, and the modifiers on a measure section variable are number values.

So you need to use the scale modifier (and optionally the decimal places modifier) in the [SectionVariable]. You will have to "scale" by some set amount, and not "autoscale". It would take something a bit more complicated to replicate true AutoScale.

Code: Select all

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

[Metadata]
Name=EmptyRecBin

[Variables]
Scale=1048576
ScalePostfix=M
Decimals=2

[measureBinItems]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=COUNT
UpdateDivider=3

[measureBinSize]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=SIZE
UpdateDivider=3

[MeterEmpty]
Meter=Button
ButtonImage=ButtonBitmap.png
ButtonCommand=[!CommandMeasure measureBinItems "EmptyBin"]
ToolTipType=1
ToolTipText=[measureBinItems] element(s), [measureBinSize:/#Scale#, #Decimals#] #ScalePostfix#B
MouseOverAction=[!SetOption MeterText Text "Mouse OVER state"][!UpdateMeter MeterText][!Redraw]
DynamicVariables=1
2014-08-24_162942.png
As for the variable "Scale", that can be these values as desired. You will probably want to show some decimal places, so it doesn't just show "0" when there is actually something there.

1024 = Kilobytes (k)
1048576 = Megabytes (M)
1073741824 = Gigabytes (G)

Note: Don't use !Execute or !PluginBang. Those were long ago deprecated and should not be used. I corrected your code.
You do not have the required permissions to view the files attached to this post.
LCA
Posts: 2
Joined: August 24th, 2014, 6:34 pm

Re: ToolTips and Measures

Post by LCA »

Thank you! Very clear!
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ToolTips and Measures

Post by jsmorley »

Glad to help.

Actually, to get a reasonable replication of AutoScale in this context wouldn't be all that hard:

Code: Select all

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

[Metadata]
Name=EmptyRecBin

;1024 = Kilobytes (k)
;1048576 = Megabytes (M)
;1073741824 = Gigabytes (G)

[Variables]
CountText=Items
Scale=1
ScalePostfix=""
Decimals=0

[measureBinItems]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=COUNT
UpdateDivider=3
IfCondition=measureBinItems = 1
IfTrueAction=[!SetVariable CountText "Item"][!UpdateMeter *][!Redraw]
IfFalseAction=[!SetVariable CountText "Items"][!UpdateMeter *][!Redraw]

[measureBinSize]
; This measure returns the amount of items in the Recycle Bin.
Measure=Plugin
Plugin=RecycleManager.dll
RecycleType=SIZE
UpdateDivider=3
IfCondition=measureBinSize < 1024
IfTrueAction=[!SetVariable Scale "1"][!SetVariable ScalePostfix ""][!SetVariable Decimals "0"][!UpdateMeter *][!Redraw]
IfCondition2=(measureBinSize >= 1024) && (measureBinSize < 1048576)
IfTrueAction2=[!SetVariable Scale "1024"][!SetVariable ScalePostfix "k"][!SetVariable Decimals "2"][!UpdateMeter *][!Redraw]
IfCondition3=(measureBinSize >= 1048576) && (measureBinSize < 1073741824)
IfTrueAction3=[!SetVariable Scale "1048576"][!SetVariable ScalePostfix "M"][!SetVariable Decimals "2"][!UpdateMeter *][!Redraw]
IfCondition4=measureBinSize >= 1073741824
IfTrueAction4=[!SetVariable Scale "1073741824"][!SetVariable ScalePostfix "G"][!SetVariable Decimals "2"][!UpdateMeter *][!Redraw]

[MeterEmpty]
Meter=Button
ButtonImage=ButtonBitmap.png
ButtonCommand=[!CommandMeasure measureBinItems "EmptyBin"]
ToolTipType=1
ToolTipText=[measureBinItems] #CountText#, [measureBinSize:/#Scale#, #Decimals#] #ScalePostfix#B
MouseOverAction=[!SetOption MeterText Text "Mouse OVER state"][!UpdateMeter MeterText][!Redraw]
DynamicVariables=1
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: ToolTips and Measures

Post by eclectic-tech »

jsmorley wrote:The problem is that the Button meter only supports one MeasureName=, and doesn't support MeasureName2, MeasureName3, ect., and therefore no %2, %3 etc...
Learned something new today! :D ... Should the 1 measure limit be added to the Button meter info in the manual?
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: ToolTips and Measures

Post by jsmorley »

eclectic-tech wrote: Learned something new today! :D ... Should the 1 measure limit be added to the Button meter info in the manual?
In a sense, there is no reason to have a Button meter support any... There is no "bound measure" default behavior that needs to be supported like most other meters. It only does, and is only useful (such as it is) in the context of a ToolTip as I think all meters support at least a single MeasureName.
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5406
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: ToolTips and Measures

Post by eclectic-tech »

I see your point that there is no bound measure...

Anyways, thanks for the explanation on what was happening.