When Refresh Num = 0
if i click Num = 1
If i click again Num = 2
always using batterypercent2
[Measurebatg]
Measure=Calc
Formula=#Num2#
IfCondition=(#Num1# < 1)
IfTrueAction=[!HideMeter MeterBatteryPercent2][!UpdateMeter MeterBatteryPercent2][!Redraw]
IfCondition2=(#Num1# > 1)
IfTrueAction2=[!ShowMeter MeterBatteryPercent2][!UpdateMeter MeterBatteryPercent2][!Redraw]
This dont work either
It is currently April 20th, 2024, 3:49 pm
Num Variant , string show hide
-
- Posts: 9
- Joined: April 29th, 2018, 8:04 pm
Re: Num Variant , string show hide
You do not have the required permissions to view the files attached to this post.
-
- Moderator
- Posts: 1387
- Joined: April 11th, 2013, 8:08 pm
- Location: Italy
Re: Num Variant , string show hide
Doing this one piece at a time, it's very difficult to understand.
Can you post the entire code using the
Can you post the entire code using the
Code: Select all
tags here, please?
-
- Posts: 9
- Joined: April 29th, 2018, 8:04 pm
Re: Num Variant , string show hide
oh ok. the entire statusbar is the .ini file but i grab just the battery icon's stuff :
i really tried to say what is each tags with ; i really hope u can understand my concept yea i know this is very bad but im trying with a full statusbar
also big thanks for you (@fonpaolo) <3
Code: Select all
; Battery percentage in icon
[MeasureBatteryPercent]
Measure=Plugin
Plugin=PowerPlugin
PowerState=Percent
IfCondition=(MeasureBatteryPercent <= 20) && (MeasurePlugged = 1)
IfTrueAction=[!SetOption MeterBackground2 "ImageName" "#@#Images\20t.png"][!Redraw]
IfCondition2=(MeasureBatteryPercent <= 20) && (MeasurePlugged = 0)
IfTrueAction2=[!SetOption MeterBackground2 "ImageName" "#@#Images\20.png"][!Redraw]
IfCondition3=(MeasureBatteryPercent >= 21) && (MeasureBatteryPercent <=49) && (MeasurePlugged = 0)
IfTrueAction3=[!SetOption MeterBackground2 "ImageName" "#@#Images\40.png"][!Redraw]
IfCondition4=(MeasureBatteryPercent >= 50) && (MeasureBatteryPercent <=60) && (MeasurePlugged = 0)
IfTrueAction4=[!SetOption MeterBackground2 "ImageName" "#@#Images\50.png"][!Redraw]
IfCondition5=(MeasureBatteryPercent >= 61) && (MeasureBatteryPercent <=84) && (MeasurePlugged = 0)
IfTrueAction5=[!SetOption MeterBackground2 "ImageName" "#@#Images\70.png"][!Redraw]
IfCondition6=(MeasureBatteryPercent >=85) && (MeasureBatteryPercent <=99) && (MeasurePlugged = 0)
IfTrueAction6=[!SetOption MeterBackground2 "ImageName" "#@#Images\90.png"][!Redraw]
IfCondition7=(MeasureBatteryPercent >=100) && (MeasurePlugged = 0)
IfTrueAction7=[!SetOption MeterBackground2 "ImageName" "#@#Images\100.png"][!Redraw]
IfCondition8=(MeasureBatteryPercent >=100) && (MeasurePlugged = 1)
IfTrueAction8=[!SetOption MeterBackground2 "ImageName" "#@#Images\100t.png"][!Redraw]
IfCondition9=(MeasureBatteryPercent >= 21) && (MeasureBatteryPercent <=60) && (MeasurePlugged = 1)
IfTrueAction9=[!SetOption MeterBackground2 "ImageName" "#@#Images\lowt.png"][!Redraw]
IfCondition11=(MeasureBatteryPercent >= 61) && (MeasureBatteryPercent <=84) && (MeasurePlugged = 1)
IfTrueAction11=[!SetOption MeterBackground2 "ImageName" "#@#Images\70t.png"][!Redraw]
IfCondition10=(MeasureBatteryPercent >=85) && (MeasureBatteryPercent <=99) && (MeasurePlugged = 1)
IfTrueAction10=[!SetOption MeterBackground2 "ImageName" "#@#Images\90t.png"][!Redraw]
; measure plug
[MeasurePlugged]
Measure=Plugin
Plugin=PowerPlugin
PowerState=ACLine
IfCondition=(MeasurePlugged = 1)
IfTrueAction=[!SetOption MeterChargingIcon "ImageName" "#@#Images\villam.png"][!Redraw][Play "low_battery_notification.wav"]
IfFalseAction=[!SetOption MeterChargingIcon "ImageName" ""][!Redraw]
[Variables]
Num1=0
; the icon backgroung
[MeterBackgroundkattbat2]
Meter=Image
ImageName=#@#Images\bat\alap#Num1#.png
DynamicVariables=1
H=18
W=52
X=1243
Y=0
LeftMouseUpAction=[!SetVariable Num1 "(#Num1# = 1 ? #Num1# + 1 : 1 )"][!UpdateMeter MeterImage][!Redraw]
; That thing if i click i named "menu"
[MeterBackgroundbatg]
Meter=Image
ImageName=#@#Images\bat\bat_background#Num1#.png
DynamicVariables=1
H=90
W=185
X=1123
Y=19
; Thats what i want !! Battery percentage in "menu"
[MeterBatteryPercent2]
Meter=String
MeasureName=MeasureBatteryPercent
X=1160
Y=30
FontSize=8
FontFamily=ClobberGroteskMedium
AntiAlias=1
FontColor=0,0,0,255
Text=Battery percent: %1%
DynamicVariables=1
; this is for menu's battery string
[Measurebatg]
Measure=Calc
Formula=#Num2#
IfCondition=(#Num1# <= 1)
IfTrueAction=[!HideMeter MeterBatteryPercent2][!UpdateMeter MeterBatteryPercent2][!Redraw]
IfCondition2=(#Num1# > 1)
IfTrueAction2=[!ShowMeter MeterBatteryPercent2][!UpdateMeter MeterBatteryPercent2][!Redraw]
; Charging icon for the icon
[MeterChargingIcon]
Meter=Image
X=1243
Y=3
H=14
W=25
DynamicVariables=1
; thats the icon's "foundation"
[MeterBackground2]
Meter=Image
ImageName=#@#Images\alap.png
DynamicVariables=1
H=14
W=25
X=1243
Y=3
; this is the icon right battery percentage in the pictures
[MeterBatteryPercent]
Meter=String
MeasureName=MeasureBatteryPercent
X=1269
Y=4
FontSize=8
FontFamily=ClobberGroteskMedium
AntiAlias=1
FontColor=0,0,0,255
Text=%1%
DynamicVariables=1
also big thanks for you (@fonpaolo) <3
-
- Rainmeter Sage
- Posts: 16150
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Num Variant , string show hide
I read just now the post and have a few things to clarify. Starting from the beginning:
- As fonpaolo said, the IfConditions are working on measures, not a meters (this had been fixed, in the meantime, I think).
- In the initial code, you had the following IfConditions:
These two conditions are not covering the situation when the value of the Num1 variable is 1, because (#Num1# < 1) means values up to 0 (not to 1!), while (#Num1# = 2) means exactly 2. So, what should have to happen, when Num1 is 1?
Code: Select all
IfCondition=(#Num1# < 1) IfTrueAction=[!HideMeter MeterBatteryPercent2 ""] IfCondition2=(#Num1# = 2) IfTrueAction2=[!ShowMeter MeterBatteryPercent2 ""]
- The !HideMeter / !ShowMeter bangs posted in the following piece of code:
(https://forum.rainmeter.net/viewtopic.php?p=148046#p148046) are wrong. The last quotations are not needed (or have to be placed around the name of the meter):
Code: Select all
IfCondition=(#Num1# < 1) IfTrueAction=[!HideMeter MeterBatteryPercent2 ""] IfCondition2=(#Num1# = 2) IfTrueAction2=[!ShowMeter MeterBatteryPercent2 ""]
(also noticed by fonpaolo)Code: Select all
IfCondition=(#Num1# < 1) IfTrueAction=[!HideMeter "MeterBatteryPercent2"] IfCondition2=(#Num1# = 2) IfTrueAction2=[!ShowMeter "MeterBatteryPercent2"]
- Although the [Measurebatg] measure is using the dynamically set Num1 variable, the DynamicVariables=1 option is missing there. Add it.
-
- Rainmeter Sage
- Posts: 16150
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Num Variant , string show hide
The !UpdateMeter bang isn't needed, beside the !HideMeter. !Redraw eventually yes, but !UpdateMeter not.fonpaolo wrote:...but this: [!HideMeter MeterBatteryPercent2 ""] should be in this way:
[!HideMeter MeterBatteryPercent2]
...and probably, better to add:
[!UpdateMeter MeterBatteryPercent2][!Redraw]
It is not needed, because if you hide the meter, usually it doesn't have to be updated. On the other hand, when a meter hides (or shows up), the skin have to (can) be redrawn, that's why is a good idea to add the !Redraw bang.
When you're using the !ShowMeter (to show up the meter), then yes, many times is a good idea to update it (to appear updated), but not when you're hiding it.
-
- Posts: 9
- Joined: April 29th, 2018, 8:04 pm
Re: Num Variant , string show hide
Oh thx for reply !!
So i tried everything and yea NOW its works !! The problem was Dynamicvariables=1 , (#Num1# < 1) And UpdateMeter at Hiding .
Thanks Everything !
For fast responsible and for big help (@balala,@fonpaolo) <3
So i tried everything and yea NOW its works !! The problem was Dynamicvariables=1 , (#Num1# < 1) And UpdateMeter at Hiding .
Thanks Everything !
For fast responsible and for big help (@balala,@fonpaolo) <3
-
- Rainmeter Sage
- Posts: 16150
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Num Variant , string show hide
Ok, I'm glad if you got it working.Teemodres wrote:The problem was Dynamicvariables=1 , (#Num1# < 1) And UpdateMeter at Hiding .
However, the !UpdateMeter added near the !HideMeter didn't cause any issue (it was not an issue which would have caused the skin to fail), the missing DynamicVariables=1 did.
-
- Moderator
- Posts: 1387
- Joined: April 11th, 2013, 8:08 pm
- Location: Italy
Re: Num Variant , string show hide
Based on my experiences, sometimes it helps...balala wrote:Ok, I'm glad if you got it working.
However, the !UpdateMeter added near the !HideMeter didn't cause any issue (it was not an issue which would have caused the skin to fail), the missing DynamicVariables=1 did.
I don't know if, perhaps, I'm using too complex skins with a lot of bangs, or whatever, however, adding UpdateMeter could help.
-
- Rainmeter Sage
- Posts: 16150
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Num Variant , string show hide
Well, I'd say it doesn't, from my experience I didn't see a case when it did. As I said, with !ShowMeter, it definitely can do (many times, but not all times), but with !HideMeter...fonpaolo wrote:Based on my experiences, sometimes it helps...
I don't know if, perhaps, I'm using too complex skins with a lot of bangs, or whatever, however, adding UpdateMeter could help.
Just think logically, if you hide a meter, why would you have to update it?
-
- Moderator
- Posts: 1387
- Joined: April 11th, 2013, 8:08 pm
- Location: Italy
Re: Num Variant , string show hide
Probably because I'm using Hide and Show at the same time in the same series of bangs, so an UpdateMeterGroup or UpdateMeter *, doesn't hurt...
As I said before, this is anything but the normality, but sometimes it helps.
As I said before, this is anything but the normality, but sometimes it helps.