It is currently March 28th, 2024, 6:28 pm

show/hide config help

Get help with creating, editing & fixing problems with skins
Post Reply
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

show/hide config help

Post by gmvolk »

OK, so I seem to be having some problems and I need some help. I am creating a battery skin, well actually modifying the battery skin from superbar by ~Leonick. I want to be able to show or hide my battery low warning skin, in sub-folder of the battery skin, based on the percent of charge left. Here is what I have so far

Code: Select all

[Variables]
TogglePath=SuperBar\Addons\Battery\warn
ToggINI=warn.ini
FullPath="SuperBar\Addons\Battery\warn\warn.ini"

[MeasurePower1]
Measure=Plugin
PlugIn=PlugIns\PowerPlugin.dll
PowerState=ACLINE
Substitute=".00000":"","0":"Using battery power","1":"Using external power source"
IfAboveValue=0
IfAboveAction=!Execute [!ShowMeter ACOn][!RainmeterDeActivateConfig #TogglePath# #ToggINI#][!Update]
IfBelowValue=1
IfBelowAction=!Execute [!HideMeter ACOn][!RainmeterActivateConfig #TogglePath# #ToggINI#][!Update]

[MeasurePower3]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
Substitute=".00000":""
IfAboveValue=50%
IfAboveAction=!Execute [!Hide #TogglePath# #ToggINI#][!Update]
IfBelowValue=30
IfBelowAction=!Execute [!Show #TogglePath# #ToggINI#][!Update]
DynamicVariables=1
It seems like it does not responde to the If actions in [MeasurePower3], plus the rainmeter log keeps warning that the warn.ini is already activated. Thanks.
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: show/hide config help

Post by AlC »

this shoud work ( I put your IfAboveValue down to 29 because in your skin your warn skin would shown till 50%)
it should work without the Substitute

Code: Select all

[MeasurePower3]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
;Substitute=".00000":""
IfAboveValue=29
IfAboveAction=!Execute [!Hide SuperBar\Addons\Battery\warn]
IfBelowValue=30
IfBelowAction=!Execute [!Show SuperBar\Addons\Battery\warn]
or with your Variables

Code: Select all


[Variables]
TogglePath=SuperBar\Addons\Battery\warn
ToggINI=warn.ini
FullPath="SuperBar\Addons\Battery\warn\warn.ini"

[MeasurePower1]
Measure=Plugin
PlugIn=PlugIns\PowerPlugin.dll
PowerState=ACLINE
;Substitute=".00000":"","0":"Using battery power","1":"Using external power source"
IfAboveValue=0
IfAboveAction=!Execute [!ShowMeter ACOn][!RainmeterDeActivateConfig #TogglePath# #ToggINI#][!Redraw]
IfBelowValue=1
IfBelowAction=!Execute [!HideMeter ACOn][!RainmeterActivateConfig #TogglePath# #ToggINI#][!Redraw]
DynamicVariables=1

Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
;Substitute=".00000":""
IfAboveValue=29
IfAboveAction=!Execute [!Hide #TogglePath#]
IfBelowValue=30
IfBelowAction=!Execute [!Show #TogglePath#]
DynamicVariables=1
Maybe you don't need #ToggINI# in your RainmeterDeActivateConfig bang

And you don't need !Update or !Redraw when you use configbangs like !Hide or !Toggle
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: show/hide config help

Post by gmvolk »

So, its those if statements that were causing me problems! I have done VB and C, some scripting, and some old basic programming, but the if's in rainmeter are iffy(sorry for the bad pun). So an ifabove and ifbelow need to be within 1 number of eachother? What if I put in an ifequal, say ifequal=50(for fifty percent charge) then show a 5-10 second config to say your at half power?

Code: Select all

IfAboveValue=29
IfAboveAction=!Execute [!Hide #TogglePath#]
IfBelowValue=30
IfBelowAction=!Execute [!Show #TogglePath#]
IfEqualValue=50
IfEqualAction=!Execute [!Show halfwarningPATH]
DynamicVariables=1
If the halfwarning.ini is in the same folder as the warn.ini, how does the !hide or !show know which one to show if they only use the path name? Or, do I need to specifically keep them in different paths?

Thanks
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: show/hide config help

Post by AlC »

Code: Select all

IfAboveValue=50
IfAboveAction=!Execute [!Hide #TogglePath#]
IfBelowValue=30
IfBelowAction=!Execute [!Show #TogglePath#]
You could do this like in your first post. So if your Power is under 30 -> then it show your skin till your Power is over 50 -> then it hides your skin. Should be no problem. This with the value 29 and 30 was only my personal choice so you have a kind of a "edge" at 30 % (like everything above 30 -> no skin, everthing under 30 -> warn skin), sorry when this confuse you.
If the halfwarning.ini is in the same folder as the warn.ini, how does the !hide or !show know which one to show if they only use the path name? Or, do I need to specifically keep them in different paths?
It isn't good to have 2 or more ini's in the same folder, except you want different variants of a skin
Example:
path: TestTheme\Bar\Power\ and in this path you have some ini's
PowerGreen.ini PowerYellow.ini PowerBlack.ini ....

I suggest you in your case something like that then:
SuperBar\Addons\Battery\warn\warn.ini
SuperBar\Addons\Battery\halfwarning\halfwarning.ini

to use a bang you need the skinname
SomeMouseAction=!Execute [!Show SuperBar\Addons\Battery\warn][!Hide SuperBar\Addons\Battery\halfwarning]

maybe this will help you, too http://rainmeter.net/forum/viewtopic.php?f=15&t=2232

EDIT:
What if I put in an ifequal, say ifequal=50(for fifty percent charge) then show a 5-10 second config to say your at half power?
The skin would be shown till you hide it or toogle it.
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: show/hide config help

Post by gmvolk »

Thank you, I appreciate your help. What you wrote wasn't confusing, it's just my understanding of the if's and were to put things in the skin file. I am learning quite a bit, and I can see the huge power of rainmeter and what it can do.

Thanks
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: show/hide config help

Post by gmvolk »

Well it seemed to work as you suggested. But then it started to show my battery warning even unplugging the power, with no regards to the measurepowerpercent if statements. Here is my full code, what I want to happen is to show/activate my warning when on battery power and below 30% charge. Hide or deactivate when on AC or above 30%.

Thanks

Code: Select all

[Rainmeter]
Update=1000
;OnRefreshAction=!Execute [!RainmeterActivateConfig #TogglePath# #ToggINI#]

;Metadata added by RainBrowser
;http://rainmeter.net/RainWiki/index.php?title=Rainmeter_101#.5BMetadata.5D

[Metadata]
Name=
Config=
Description=
Instructions=
Version=
Tags=
License=
Variant=
Preview=

;End of added Metadata

[Variables]
TogglePath=SuperBar\Addons\Battery\warn
ToggINI=warn.ini

[Author]
http://leonick.deviantart.com/
;Modifications by gmvolk

[MeasurePowerPercent]
Measure=Plugin
Plugin=Plugins\PowerPlugin.dll
PowerState=PERCENT
IfAboveValue=29
IfAboveAction=!Execute [!RainmeterDeActivateConfig #TogglePath#]
;[!Hide #TogglePath#]
IfBelowValue=30
IfBelowAction=!Execute [!RainmeterActivateConfig #TogglePath# #ToggINI#]
;[!Show #TogglePath#]
DynamicVariables=1

[MeasurePowerSource]
Measure=Plugin
PlugIn=PlugIns\PowerPlugin.dll
PowerState=ACLINE
Substitute=".00000":"","0":"Using battery power","1":"Using external power source"
IfAboveValue=0
IfAboveAction=!Execute [!ShowMeter MeterACOn][!RainmeterDeActivateConfig #TogglePath#][!Redraw]
IfBelowValue=1
IfBelowAction=!Execute [!HideMeter MeterACOn][!RainmeterActivateConfig #TogglePath# #ToggINI#][!Redraw]

[MeterPercentPercent]
Meter=String
MeasureName=MeasurePowerPercent
DynamicVariables=1
StringStyle=Bold
FontFace=Tahoma
FontColor=255,255,255,255
FontSize=8
AntiAlias=1
StringEffect=SHADOW
FontEffectColor=0,0,0
x=18
y=1
Percentual=1
Text="%1%"
LeftMouseDoubleClickAction=!Execute ["shell:::{025A5937-A6BE-4686-A844-36FE4BEC8B6D}"]

[MeterBarPercent]
Meter=Bar
MeasureName=MeasurePowerPercent
BarImage=Battery Full.png
BarOrientation=Horizontal
x=0
y=0

[MeterACOn]
Meter=Image
ImageName=lightning.ico
x=0
y=0
hidden=1
User avatar
AlC
Posts: 329
Joined: June 9th, 2011, 6:46 pm

Re: show/hide config help

Post by AlC »

But then it started to show my battery warning even unplugging the power, with no regards to the measurepowerpercent if statements.
Okey, the state is for example: your power is 73 % and now you unplugg your Power
So [MeasurePowerPercent] deactivate your config -> because your power is over 29
BUT [MeasurePowerSource] activate your config -> because you unplugg your power

Rainmeter work from top to bottom (as far as I know). -> so the bang([!RainmeterActivateConfig #TogglePath# #ToggINI#]) from [MeasurePowerSource] has in this case a "higher priority" than the bang ([!RainmeterDeActivateConfig #TogglePath#]) in [MeasurePowerPercent]
what I want to happen is to show/activate my warning when on battery power and below 30% charge. Hide or deactivate when on AC or above 30%
so you have 2 options

1: you do it with lua like:
if MeasurePowerSource=0 and MeasurePowerPercent<30 then -> bang activate config
if MeasurePowerSource=1 or MeasurePowerPercent>29 then -> bang deactivate config
tip: http://rainmeter.net/cms/LuaScripting_beta

2 or you do it with Rainmeter
You could add this and delete the bangs from the measures (and I'm not an expert with this calcs and don't have a laptop to test it)

Code: Select all

[cActivate]
Measure=Calc
Formula=(([MeasurePowerSource]=0)&&([MeasurePowerPercent]<30))?2:0
DynamicVariables=1
IfAboveValue=1
IfAboveAction=[!RainmeterActivateConfig #TogglePath# #ToggINI#]

[cDeactivate]
Measure=Calc
Formula=(([MeasurePowerSource]=1)||([MeasurePowerPercent]>29))?2:0
DynamicVariables=1
IfAboveValue=1
IfAboveAction=[!RainmeterDeactivateConfig #TogglePath#]
tip:
http://rainmeter.net/cms/Measures-Calc_beta
http://rainmeter.net/cms/Plugins-Power_beta
User avatar
smurfier
Moderator
Posts: 1931
Joined: January 29th, 2010, 1:43 am
Location: Willmar, MN

Re: show/hide config help

Post by smurfier »

1)Only put brackets on your bangs when using !Execute.
2)Conditional statements evaluate to 1 (true) or 0 (false). You can use this with IfEqual to eliminate a few characters.

Code: Select all

[cActivate]
Measure=Calc
Formula=([MeasurePowerSource]=0)&&([MeasurePowerPercent]<30)
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!RainmeterActivateConfig #TogglePath# #ToggINI#

[cDeactivate]
Measure=Calc
Formula=([MeasurePowerSource]=1)||([MeasurePowerPercent]>29)
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!RainmeterDeactivateConfig #TogglePath#
3) You should be able to combine both measures into one using nested conditional statements.

Code: Select all

[cActivate]
Measure=Calc
Formula=([MeasurePowerSource]=0)&&([MeasurePowerPercent]<30)?1:(([MeasurePowerSource]=1)||([MeasurePowerPercent]>29)?2:0)
DynamicVariables=1
IfEqualValue=1
IfEqualAction=!RainmeterActivateConfig #TogglePath# #ToggINI#
IfAboveValue=1
IfAboveAction=!RainmeterDeactivateConfig #TogglePath#
User avatar
gmvolk
Posts: 56
Joined: September 26th, 2011, 11:02 pm

Re: show/hide config help

Post by gmvolk »

Thanks, I'll look into LUA scripting, seems to be more powerfull. Right now, it looks as if it is working again, although I have not changed anything! Makes me wonder if rainmeter is more event driven like visual basic and depending on which event fires first/last your results may be unpredictable. Oh well, no one ever said learning was easy, thanks again.
Post Reply