It is currently April 18th, 2024, 5:57 pm

Reference of meter

Get help with installing and using Rainmeter.
disawar
Posts: 3
Joined: August 4th, 2018, 6:34 pm

Reference of meter

Post by disawar »

Hello! i'm new here and I really like this software. I have experience in coding but I need some help to understand some details

I have variable:
CurrentItem=0

And some meters:
[Item1]
..
[Item10]

How can i get the reference of meter? I'm trying this code but it does not work
[&Item[#CurrentItem]]

I need to do the following stuff
[!SetOption [&Item[#CurrentItem]] SolidColor "0,0,0,0"]
User avatar
balala
Rainmeter Sage
Posts: 16144
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Reference of meter

Post by balala »

disawar wrote:I need to do the following stuff
[!SetOption [&Item[#CurrentItem]] SolidColor "0,0,0,0"]
First you have to add a DynamicVariables=1 option to the meter / measure which use those Nesting Variables.
But secondly, I don't think in this case a such complicated approach would be needed. You can simply use the following form of the bang: [!SetOption Item#CurrentItem# SolidColor "0,0,0,0"] (or probably a similar result would be given by the [!HideMeter "Item#CurrentItem#"] bang, but this only if you don't have there something like a shadow, which has to remain visible, even if you set transparent fonts). Take care that this approach also requires the DyanmicVariables=1 option.
disawar
Posts: 3
Joined: August 4th, 2018, 6:34 pm

Re: Reference of meter

Post by disawar »

Thank you it help! I have one more question.
Rainmeter Logs throw an error "Calc: Division by 0", but I did check for a negative number.

Code: Select all

[Variables]
Value=1

[MeasureCalc]
Measure=Calc
Formula=#Value# = 0 ? 0 : (100/#Value#)
MinValue=0
MaxValue=100
DynamicVariables=1
disawar
Posts: 3
Joined: August 4th, 2018, 6:34 pm

Re: Reference of meter

Post by disawar »

Here the solution. Thank @sclaronda for helping me in discord.

Code: Select all

Formula=#Value# = 0 ? 0 : (100*(#Value#**(-1)))