It is currently March 29th, 2024, 4:36 am

Changing number of icons with Variable

Get help with creating, editing & fixing problems with skins
P2C
Posts: 45
Joined: November 13th, 2009, 10:22 pm
Location: near Würzburg, Germany

Changing number of icons with Variable

Post by P2C »

I'm planning to do a tabbed dock with the ability to change the number of icons with one variable. It should go from 1 - 20. Well, I already found a way to do so, but it's not very clever:

Code: Select all

[CalcIcon1]
Measure=Calc
Formula=(#NumberOfShortcuts#-1)
IfBelowValue=0
IfBelowAction=!RainmeterHideMeter Icon1

[CalcIcon2]
Measure=Calc
Formula=(#NumberOfShortcuts#-2)
IfBelowValue=0
IfBelowAction=!RainmeterHideMeter Icon2

[CalcIcon3]
Measure=Calc
Formula=(#NumberOfShortcuts#-3)
IfBelowValue=0
IfBelowAction=!RainmeterHideMeter Icon3
It does what I need, but I would have to use 20 Measures.

Is there any way to do that more easy?
I thought I could use a conditional operator, but to be honest, I'm not quite sure how to exactly do it.

Thanks in advance :)
User avatar
~Faradey~
Posts: 366
Joined: November 12th, 2009, 4:47 pm
Location: Ukraine

Re: Changing number of icons with Variable

Post by ~Faradey~ »

Pard me in case I wrong understand you but here what i would did

for exemple...

Code: Select all

[Rainmeter]
OnRefreshAction=!execute [!RainmeterSetVariable I1 (#NofS#+1)][!RainmeterSetVariable I2 (#NofS#+2)][!RainmeterSetVariable I3 (#NofS#+3)]

[Variables]
NofS=3
;NofS - NumberOfShortcuts
I1=1
I2=2
I3=3
... etc

[CheckIcons]
Measure=Calc
Formula=CheckIcons+1
IfEqualValue=4
IfEqualAction=!execute [!RainmeterHideMeter Meter#I1#Icon][!RainmeterHideMeter Meter#I2#Icon][!RainmeterHideMeter Meter#I3#Icon]...etc
DynamicVariables=1
IfAboveValue=6
IfAboveAction=!RainmeterDisableMeasure CheckIcons

[Meter1.000000Icon]
...
[Meter2.000000Icon]
...
[Meter3.000000Icon]
...
[Meter4.000000Icon]
...
[Meter5.000000Icon]
...
[Meter6.000000Icon]
...
.....
[Meter20.000000Icon]
            

etc...
P2C
Posts: 45
Joined: November 13th, 2009, 10:22 pm
Location: near Würzburg, Germany

Re: Changing number of icons with Variable

Post by P2C »

I'll try that. Thanks :)