It is currently May 6th, 2024, 2:11 am

If statements with hiding meters

Get help with creating, editing & fixing problems with skins
datacenter
Posts: 2
Joined: February 3rd, 2012, 12:24 pm

If statements with hiding meters

Post by datacenter »

Hi guys,

I have lost around 30 hours researching how could I hide a meter based on automatically generated value. Actually the idea is to hide info/covers when the state of "winamp" is put to "stop". So here is my example code:
[mState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Winamp
PlayerType=STATE
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter Background]
Tried including a Calc measure.... not sure if this is even logically true:
[mState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Winamp
PlayerType=STATE

[Hide]
Measure=Calc
Formula=[mState]
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter Background]
Any help will be highly appreciated :)
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: If statements with hiding meters

Post by Brian »

datacenter wrote:

Code: Select all

[mState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Winamp
PlayerType=STATE
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterHideMeter Background]
This code works for me, however I would add another if statement to show the background when the player is not "stopped".

Like this:

Code: Select all

[mState]
Measure=Plugin
Plugin=NowPlaying.dll
PlayerName=Winamp
PlayerType=STATE
IfEqualValue=0
IfEqualAction=!Execute [!HideMeter Background]
IfAboveValue=0
IfAboveAction=!Execute [!ShowMeter Background]
If you are going to Hide/Show more than one meter, try using Meter Groups.

Also, remember the meter will hide on the next update cycle.

-Brian
crosseout
Posts: 11
Joined: February 2nd, 2012, 8:20 pm

Re: If statements with hiding meters

Post by crosseout »

try this:
IfEqualAction=!Execute [!RainmeterHideMeter Background][!RainmeterRefresh]
datacenter
Posts: 2
Joined: February 3rd, 2012, 12:24 pm

Re: If statements with hiding meters

Post by datacenter »

Thanks Brian... it is working now.

Have a nice day all :)
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: If statements with hiding meters

Post by Asagrim »

Following the same pattern, code:

Code: Select all

[Ms_USB2State]
Measure=FreeDiskSpace
Drive="#USB2#:"
Type=1
IgnoreRemovable=0
IfEqualValue=1
IfEqualAction=!Execute [!HideMeterGroup USB2] [!Redraw]
IfAboveValue=1
IfEqualAction=!Execute [!ShowMeterGroup USB2] [!Redraw]
doesn't work entirely.

Measure=FreeDiskSpace
Type
If set to 1 this returns the type of the drive.
String >> numeric return:
Error >> 0
Removed >> 1
Removable >> 3
Fixed >> 4
Network >> 5
CDRom >> 6
Ram >> 7

So far so good. But the code does the following:
I refresh the skin with the USB not plugged in, the meters in the group are all visible, display all the information, bars, everything, with zero values. Then i plug in my USB, then all meters work as intended. Then i unplug my USB, and THEN [Ms_USB2State] finally hides all the meters (the USB2 group) ... permanently though, because if i plug it in again, it stays hidden. Long story short, i hate IfActions! -.-
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: If statements with hiding meters

Post by Brian »

You have an extra "IfEqualAction"......it should be "IfAboveAction"

Try this:

Code: Select all

[Ms_USB2State]
Measure=FreeDiskSpace
Drive="#USB2#:"
Type=1
IgnoreRemovable=0
IfEqualValue=1
IfEqualAction=!Execute [!HideMeterGroup USB2] [!Redraw]
IfAboveValue=1
IfAboveAction=!Execute [!ShowMeterGroup USB2] [!Redraw]
-Brian
Asagrim
Posts: 126
Joined: August 12th, 2011, 12:30 pm

Re: If statements with hiding meters

Post by Asagrim »

My apologies, it was a typo then. :oops:
Maybe if i would focus on only one issue at a time ... lol! Sorry again!
User avatar
Brian
Developer
Posts: 2689
Joined: November 24th, 2011, 1:42 am
Location: Utah

Re: If statements with hiding meters

Post by Brian »

No need to apologize, I can't tell you how many times I make typos like that! :D

-Brian