It is currently May 7th, 2024, 11:27 pm

Meter On/Off toggle by variable

Report bugs with the Rainmeter application and suggest features.
hello123456
Posts: 32
Joined: October 5th, 2010, 3:53 pm

Meter On/Off toggle by variable

Post by hello123456 »

I'm improving my Unity for Rainmeter config, and I found a function that's missing.
I want to be able to toggle certain meters on/off based on a variable.
As you know Unity is a sidebar for Ubuntu, which I ported to Rainmeter. (V1 Found here: Click)
For the icons I'm using Relative positions. So when a higher placed icon is off all others will automatically move upwards. Leaving no gaps on the bar.

Some visual feedback to help understand:

Image

Now I can hide certain meters using:
Hidden=1
But this will only hide it, and not turn it off completely.

I could turn it off by doing:
;Meter=Image
&
;Meter=String
But this requires allot of scrolling, good searching and lots of clicks to turn it off, which isn't really practical.

A better way would be adding this to the meter
Toggle=0/1

Making me able to put this on top of the skin:

Code: Select all

App2=PathToApp
App2Title=AppTitle
App2Icon=PathToIcon
App2Enable=0/1
And make it possible for me to use: http://fediafedia.deviantart.com/art/Rainmeter-skin-config-164384901

Which is as, you can see, much more user friendly to work with.
I hope you agree with me and that this will make it's way into the application.
Last edited by hello123456 on January 27th, 2011, 10:55 pm, edited 1 time in total.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Meter On/Off toggle by variable

Post by jsmorley »

Maybe I don't completely understand your issue, but if you use "R" (and not "r") when doing "relative positioning", hidden meters are in fact as if they are "not there" and meters below / beside them move to adjust.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1

[Meter1]
Meter=Image
SolidColor=255,0,0,255
W=50
H=50

[Meter2]
Meter=Image
SolidColor=0,255,0,255
Y=1R
W=50
H=50

[Meter3]
Meter=Image
SolidColor=0,0,255,255
Y=1R
W=50
H=50

[Meter4]
Meter=String
Y=160
FontSize=12
FontColor=255,255,255,255
SolidColor=0,0,0,1
Text="Hide Meter 1"
LeftMouseUpAction=!Execute [!RainmeterHideMeter Meter1][!RainmeterShowMeter Meter2][!RainmeterShowMeter Meter3]

[Meter5]
Meter=String
Y=180
FontSize=12
FontColor=255,255,255,255
SolidColor=0,0,0,1
Text="Hide Meter 2"
LeftMouseUpAction=!Execute [!RainmeterHideMeter Meter2][!RainmeterShowMeter Meter1][!RainmeterShowMeter Meter3]

[Meter6]
Meter=String
Y=200
FontSize=12
FontColor=255,255,255,255
SolidColor=0,0,0,1
Text="Hide Meter 3"
LeftMouseUpAction=!Execute [!RainmeterHideMeter Meter3][!RainmeterShowMeter Meter1][!RainmeterShowMeter Meter2]

[Meter7]
Meter=String
Y=220
FontSize=12
FontColor=255,255,255,255
SolidColor=0,0,0,1
Text="Show All"
LeftMouseUpAction=!Execute [!RainmeterShowMeter Meter1][!RainmeterShowMeter Meter2][!RainmeterShowMeter Meter3]
hello123456
Posts: 32
Joined: October 5th, 2010, 3:53 pm

Re: Meter On/Off toggle by variable

Post by hello123456 »

True (didn't knew it yet but still), but that doesn't fix the problem.
Now you still have to click something to hide it. Which ain't an option in this skin.
Also there's the problem that if you config your bar some way, you want it to remain like that the next time you start Rainmeter.

Also the Text is hidden by default (hidden=1), showing up when you hover over the icon. Since the next icon has a position relative to the text of the previous one using R will make everything disappear.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Meter On/Off toggle by variable

Post by jsmorley »

The hidden state can be set in a variable, like

[Variables]
Meter1State=1
Meter2State=1

[Meter1]
Meter=String
Hidden=#Meter1State#

[Meter2]
Meter=String
Hidden=#Meter2State#

Then just have your configuration tool set the state of each meter using either 0 or 1 in the variable.

Or search the beta manual for !RainmeterWriteKeyValue. There is probably something that can be done with that. Either that or get the source to RainConfigure and change it to actually alter the .ini based on choices made in it and comment out meters and refresh the skin.
hello123456
Posts: 32
Joined: October 5th, 2010, 3:53 pm

Re: Meter On/Off toggle by variable

Post by hello123456 »

Yeah I know it can be put in a variable like that, but that doesn't cut it.
Perhaps a snippet of the code will point it out:

Code: Select all

[Rainmeter]
Author=Hello-123456
Update=1000
DynamicWindowSize=1

[Variables]
Font=Trebuchet MS
Color=FFFFFF
Size=10
Style=Bold
Style=Normal
Taskbarheight=38

;Taskbarheight Values:
;Win XP: 30
;Win Vista: 30
;Win 7 Small Icons: 31
;Win7 Big Icons: 38

;-------------------------------

[MeasureScreen]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=SCREEN_HEIGHT

[MeterUnity]
Meter=IMAGE
X=0
Y=0
H=([MeasureScreen]-#Taskbarheight#)
W=58
SolidColor=255,255,255,255
ImageAlpha=255
DynamicVariables=1

;-------------------------------

[MeterIcon1]
Meter=IMAGE
X=4
Y=8r
H=48
W=48
SolidColor=255,0,0,255
MouseOverAction=!execute [!RainmeterShowMeter APP1_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP1_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files\Adobe\Adobe Illustrator CS5\Support Files\Contents\Windows\Illustrator.exe"]

[APP1_Text]
Meter=STRING
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text=Adobe Illustrator CS5
Hidden=1

;-------------------------------

[MeterIcon2]
Meter=IMAGE
X=4
Y=38r
H=48
W=48
SolidColor=0,255,0,255
MouseOverAction=!execute [!RainmeterShowMeter APP2_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP2_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe"]

[APP2_Text]
Meter=String
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text=Adobe Photoshop CS5
Hidden=1

;-------------------------------

[MeterIcon3]
Meter=IMAGE
X=4
Y=38r
H=48
W=48
SolidColor=0,0,255,255
MouseOverAction=!execute [!RainmeterShowMeter APP3_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP3_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files (x86)\Opera\opera.exe"]

[APP3_Text]
Meter=String
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text="Opera 11.00"
Hidden=1
(Replaced Icons and background with solidcolors)

Since the text is already hidden by default (to make it show when you go over the icon), I can't use R. It messes up the location of everything. Try it and you'll see for yourself.
WriteKeyValue isn't going to change anything about that (although I am happy to see that feature being included now). Yes I might be able to toggle the Hide on/off, but since I can't use R hiding it won't help. Also WriteKeyValue still requires something to be clicked, hovered etc. which as I stated earlier, ain't possible for this skin.

A good way to make toggle=0/1 work would be that Rainmeter reads Meter=None when it detects it, overriding Hidden=1 completely. I've already tested that this would solve the problem, since ;Meter=Image works flawless here. (Off-course I should not toggle of the first icon, because that includes the space from the top side of the screen, unless you make allot of IF statements checking whether or not an icon is the first icon of the skin.).
hello123456
Posts: 32
Joined: October 5th, 2010, 3:53 pm

Re: Meter On/Off toggle by variable

Post by hello123456 »

After some serious trying I can't find anything that does what I want.

Currently I'm trying:

Code: Select all

[MeasureApp2]
Measure=Calc
Formula=#App2Enable#
IfEqualValue=0
IfEqualAction=!Execute [!RainmeterSetVariable Image2Meter ""][!RainmeterSetVariable Text2Meter ""]
IfAboveValue=0
IfAboveAction=!Execute [!RainmeterSetVariable Image2Meter "Image"][!RainmeterSetVariable Text2Meter "String"]
Where App2Enable=0/1, and Image2Meter and Text2Meter should turn on/off a certain meter.
This brings me to 2 problems:
1. Meter=X doesn't take variables, Rainmeter will simply report that it isn't valid (which i can understand since it shouldn't be variable, but there is no other way to turn it off the way I have to get it turned off).
2. A bug in rainmeter. If I make App2Enable=0, it should make both Image2Meter and Text2Meter empty... Instead it gets the value Unity. Which it seems to get from the folder in which the skin is placed. (Running Rainmeter 1.3 rev 560 (64Bit))
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Meter On/Off toggle by variable

Post by jsmorley »

Answer from kenz0:

*************************************

Not sure if I understand you correctly. I would use the approach of separating config with @Include, then change them to enable/disable.

For example, here is his case.

Main Config:

Code: Select all

[Variables]
Font=Trebuchet MS
Color=FFFFFF
Size=10
Style=Bold
Style=Normal
Taskbarheight=38

@Include1=app1.inc
@Include2=app2.inc
@Include3=app3.inc

;-------------------------------

[MeasureScreen]
Measure=Plugin
Plugin=Plugins\SysInfo.dll
SysInfoType=SCREEN_HEIGHT

[MeterUnity]
Meter=IMAGE
X=0
Y=0
H=([MeasureScreen]-#Taskbarheight#)
W=58
SolidColor=255,255,255,255
ImageAlpha=255
DynamicVariables=1
Include Files:
Include1:

Code: Select all

[MeterIcon1]
Meter=IMAGE
X=4
Y=8r
H=48
W=48
SolidColor=255,0,0,255
MouseOverAction=!execute [!RainmeterShowMeter APP1_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP1_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files\Adobe\Adobe Illustrator CS5\Support Files\Contents\Windows\Illustrator.exe"]

[APP1_Text]
Meter=STRING
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text=Adobe Illustrator CS5
Hidden=1
Include2:

Code: Select all

[MeterIcon2]
Meter=IMAGE
X=4
Y=38r
H=48
W=48
SolidColor=0,255,0,255
MouseOverAction=!execute [!RainmeterShowMeter APP2_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP2_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files\Adobe\Adobe Photoshop CS5 (64 Bit)\Photoshop.exe"]

[APP2_Text]
Meter=String
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text=Adobe Photoshop CS5
Hidden=1

Include3:

Code: Select all

[MeterIcon3]
Meter=IMAGE
X=4
Y=38r
H=48
W=48
SolidColor=0,0,255,255
MouseOverAction=!execute [!RainmeterShowMeter APP3_Text][!RainmeterRedraw]
MouseLeaveAction=!execute [!RainmeterHideMeter APP3_Text][!RainmeterRedraw]
LeftMouseDownAction=!Execute ["D:\Program Files (x86)\Opera\opera.exe"]

[APP3_Text]
Meter=String
X=64
Y=16r
FontColor=#Color#
FontSize=#Size#
FontFace=#Font#
StringStyle=#Style#
StringAlign=LEFT
AntiAlias=1
Text="Opera 11.00"
Hidden=1
we only have to comment out @Include* line to disable some section block.
we can also switch enable/disable by changing value of @Include* with !RainmeterSetVariable or !RainmeterWriteKeyValue.
hello123456
Posts: 32
Joined: October 5th, 2010, 3:53 pm

Re: Meter On/Off toggle by variable

Post by hello123456 »

Thanks allot for all the support! I've used the suggestion and turned it into I'm satisfied with!
Didn't really use my main idea with enable/disable anymore, since it was much easier to combine it with the sorting of the icons by simply using ; on the includes.

For the show off on Rainmeter Forums go to:
http://rainmeter.net/forum/viewtopic.php?f=27&t=6714

And for information and download go to:
http://hello-123456.deviantart.com/art/Unity-for-Rainmeter-V2-0-195131585