Is there a way to find whether a meter is hidden or visible?
I would prefer not having to use a variable to accomplish what I desire.
It is currently October 9th, 2024, 7:30 pm
[HELP] Test whether Meter is hidden or visible
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
[HELP] Test whether Meter is hidden or visible
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Test whether Meter is hidden or visible
You can do this with Lua:
Note that if the meter doesn't actually have a "Hidden" key, the GetOption() will initially return a blank string, so you may need/want to set "Hidden=0" on the relevant meters, depending on what you're trying to do.
EDIT: Sorry, I may be wrong about this. Hiding the meter with !HideMeter isn't changing the returned value in my test skin. Gonna play with it some more.
Code: Select all
mMeter = SKIN:GetMeter('MeterName')
sHidden = mMeter:GetOption('Hidden')
EDIT: Sorry, I may be wrong about this. Hiding the meter with !HideMeter isn't changing the returned value in my test skin. Gonna play with it some more.
-
- Moderator
- Posts: 1931
- Joined: January 29th, 2010, 1:43 am
- Location: Willmar, MN
Re: Test whether Meter is hidden or visible
When I tried that then used !HideMeterGroup or !HideMeter, nothing was returned.
GitHub | DeviantArt | Tumblr
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
This is the song that never ends. It just goes on and on my friends. Some people started singing it not knowing what it was, and they'll continue singing it forever just because . . .
-
- Developer
- Posts: 22847
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Test whether Meter is hidden or visible
mtMeterTwo = SKIN:GetMeter("MeterTwo")
iMeterTwoHidden = mtMeterTwo:GetW()
You can also test for the width of a meter. A hidden meter will always be 0.
iMeterTwoHidden = mtMeterTwo:GetW()
You can also test for the width of a meter. A hidden meter will always be 0.
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Test whether Meter is hidden or visible
Yeah, I had the same result. See my edited post.smurfier wrote:When I tried that then used !HideMeterGroup or !HideMeter, nothing was returned.
Ironically, although "!SetOption Meter Hidden 1" does not work to hide the meter, it does actually change the value of the "option."
-
- Developer
- Posts: 22847
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: Test whether Meter is hidden or visible
Trouble with GetOption("Hidden") is that "Hidden", like MeasureName, is not one you can set with !SetOption, and GetOption in Lua will not see !HideMeter as changing the "option", so it will never change in Lua.
The width thing was the only reliable thing I found so far.
Edit: Ah. I see that Lua does see the change to the "option", but it doesn't really help as !SetOption Meter Hidden 1 doesn't actually hide the meter.
The width thing was the only reliable thing I found so far.
Edit: Ah. I see that Lua does see the change to the "option", but it doesn't really help as !SetOption Meter Hidden 1 doesn't actually hide the meter.
-
- Developer
- Posts: 1721
- Joined: July 25th, 2009, 4:47 am
Re: Test whether Meter is hidden or visible
Right. Each other property that isn't affected by !SetOption has its own "get" function in Lua (XYWH), so if possible, we should probably add a GetHidden() function as well.jsmorley wrote:Trouble with GetOption("Hidden") is that "Hidden", like MeasureName, is not one you can set with !SetOption, and GetOption in Lua will not see !HideMeter as changing the "option", so it will never change in Lua.
-
- Posts: 2
- Joined: March 15th, 2019, 2:07 pm
Re: Test whether Meter is hidden or visible
I'm sorry, sort of new.
Where do i place these lines? This is exactly what i was looking for when i came to this thread but I'm still learning lua.
https://ibb.co/H7gkf0q
You do not have the required permissions to view the files attached to this post.
-
- Developer
- Posts: 22847
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [HELP] Test whether Meter is hidden or visible
I'd need to know a bit more about what you are trying to accomplish. It may be that Lua is part of the answer, but maybe not.
-
- Developer
- Posts: 22847
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: [HELP] Test whether Meter is hidden or visible
You might do something like this to detect a hidden meter using Lua:
Skin:
Test.Lua:
Skin:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1
[Lua]
Measure=Script
ScriptFile=#CURRENTPATH#Test.lua
Disabled=1
[MeterOne]
Meter=String
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello World
[MeterTwo]
Meter=String
Y=30
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
DynamicVariables=1
Text=[&Lua:IsHidden('MeterOne')]
LeftMouseUpAction=[!ToggleMeter MeterOne][!UpdateMeter *][!Redraw]
Test.Lua:
Code: Select all
function IsHidden(meterArg)
meterHandle = SKIN:GetMeter(meterArg)
hiddenState = meterHandle:GetOption('Hidden', '0')
if hiddenState == '1' then
return meterArg.. ' is Hidden'
else
return meterArg.. ' is not Hidden'
end
end
You do not have the required permissions to view the files attached to this post.