hi there.
im currently working on completing my layout, and i decided to make a skin which can activate or deactivate other skins.
ive made a list of all skins from my layout for activate/deactivate, it works pretty well, but i cant see which skin is on or off in this list.
how i can check is skin launched or not and show a value of it as - Disabled/Enabled in a string meter?
It is currently April 24th, 2024, 2:30 am
how to check is skin activated?
-
- Posts: 19
- Joined: November 28th, 2016, 7:28 am
how to check is skin activated?
Last edited by TrueFaith on November 29th, 2016, 7:03 pm, edited 1 time in total.
-
- Rainmeter Sage
- Posts: 16164
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: how to check is skin activated?
A Rainmeter skin never knows which other skins are loaded. However a trick can be used to get these information.TrueFaith wrote:hi there.
im currently working on completing my layout, and i decided to make a skin which can activate or deactivate other skins.
ive made a list of all skins from my layout for activate/deactivate, it works pretty well, but i cant see which skin is on or off in this list.
how i can check is skin launched or not and show a value of it as - Disabled/Enabled in a string meter?
For this you have to use the WebParser measure, to read the appropriate information from Rainmeter.ini (which contains the settings of the app and the loaded skins). Eg, try the following measure:
Code: Select all
[MeasureRainmeter]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
Url=file://#SETTINGSPATH#Rainmeter.ini
RegExp=(?siU)\[ENTER-HERE-THE-NAME-OF-DESIRED-CONFIG].*Active=(.*)\n
StringIndex=1
When you enter the name of the config, be careful to escape the reserved characters (the \ char), if it exist, with another \ (so, practically if the config contains a backslash, double it).
A whole code:
Code: Select all
[Rainmeter]
Update=1000
DynamicWindowSize=1
[MeasureRainmeter]
Measure=Plugin
Plugin=WebParser
UpdateRate=1
Url=file://#SETTINGSPATH#Rainmeter.ini
RegExp=(?siU)\[CloCalWe\\Calendar\\Event].*Active=(.*)\n
StringIndex=1
[MeterRainmeter]
MeasureName=MeasureRainmeter
Meter=STRING
X=0
Y=0
Padding=15,5,15,5
FontColor=220,220,220
SolidColor=0,0,0,150
FontSize=8
FontFace=Segoe UI
StringStyle=BOLD
StringAlign=LEFT
AntiAlias=1
Text=%1
-
- Posts: 3
- Joined: August 4th, 2018, 1:08 pm
Re: how to check is skin activated?
I also have an internet theme.
This does not work if #SETTINGSPATH#Rainmeter.ini is encoded by default (1200 UTF - 16LE with BOM). In a different encoding (for example, 866 or 1251) this works fine.
Probably the reason: the WebParser plugin does not correctly work with files encoded in 1200 UTF - 16LE with BOM.
I do not know, maybe WebParser will ever be fixed ...
The solution to the problem now is to open #SETTINGSPATH#Rainmeter.ini and save it in a working encoding.
Can there still be options for controlling the skin Active?
This does not work if #SETTINGSPATH#Rainmeter.ini is encoded by default (1200 UTF - 16LE with BOM). In a different encoding (for example, 866 or 1251) this works fine.
Probably the reason: the WebParser plugin does not correctly work with files encoded in 1200 UTF - 16LE with BOM.
I do not know, maybe WebParser will ever be fixed ...
The solution to the problem now is to open #SETTINGSPATH#Rainmeter.ini and save it in a working encoding.
Can there still be options for controlling the skin Active?
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: how to check is skin activated?
https://forum.rainmeter.net/viewtopic.php?p=149824#p149824
In my opinion, that plugin is the right way to detect an active skin. I don't really recommend reading Rainmeter.ini. That is comparatively slow and brute-force.
Having said that, you can read Rainmeter.ini with WebParser, even though Rainmeter.ini is encoded as UTF-16 LE. You simply need to add:
CodePage=1200
to the parent WebParser measure that is reading the file.
https://docs.rainmeter.net/manual/measures/webparser/#CodePage
The only thing you really can't do is directly read Rainmeter.ini with a Lua script, as that simply can't read UTF-16 LE files. For that, you would need to read the entirety of the file with a WebParser measure, and use the value of that measure in Lua to do any value-added processing in Lua that you want.
P.S. I really, really don't recommend trying to change the encoding of Rainmeter.ini. Aside from being pointless, Rainmeter will simply change it back to UTF-16 LE the next time it is started.
In my opinion, that plugin is the right way to detect an active skin. I don't really recommend reading Rainmeter.ini. That is comparatively slow and brute-force.
Having said that, you can read Rainmeter.ini with WebParser, even though Rainmeter.ini is encoded as UTF-16 LE. You simply need to add:
CodePage=1200
to the parent WebParser measure that is reading the file.
https://docs.rainmeter.net/manual/measures/webparser/#CodePage
The only thing you really can't do is directly read Rainmeter.ini with a Lua script, as that simply can't read UTF-16 LE files. For that, you would need to read the entirety of the file with a WebParser measure, and use the value of that measure in Lua to do any value-added processing in Lua that you want.
P.S. I really, really don't recommend trying to change the encoding of Rainmeter.ini. Aside from being pointless, Rainmeter will simply change it back to UTF-16 LE the next time it is started.
-
- Posts: 3
- Joined: August 4th, 2018, 1:08 pm
Re: how to check is skin activated?
jsmorley wrote:https://forum.rainmeter.net/viewtopic.php?p=149824#p149824
In my opinion, that plugin is the right way to detect an active skin. I don't really recommend reading Rainmeter.ini. That is comparatively slow and brute-force.
Having said that, you can read Rainmeter.ini with WebParser, even though Rainmeter.ini is encoded as UTF-16 LE. You simply need to add:
CodePage=1200
to the parent WebParser measure that is reading the file.
https://docs.rainmeter.net/manual/measures/webparser/#CodePage
The only thing you really can't do is directly read Rainmeter.ini with a Lua script, as that simply can't read UTF-16 LE files. For that, you would need to read the entirety of the file with a WebParser measure, and use the value of that measure in Lua to do any value-added processing in Lua that you want.
P.S. I really, really don't recommend trying to change the encoding of Rainmeter.ini. Aside from being pointless, Rainmeter will simply change it back to UTF-16 LE the next time it is started.
CodePage=1200
This is what was needed to solve the problem.
You very quickly and truly helped me.
Thank you very much.
Here is an example of part of the ready-made code:
Code: Select all
[MeasureClockSkinMode]
Measure=WebParser
CodePage=1200
URL=file://#SETTINGSPATH#Rainmeter.ini
RegExp=(?siU)\[SW\\Clock].*Active=(.*)\n
UpdateRate=1
StringIndex=1
IfEqualValue=0
IfEqualAction=...
IfAboveValue=0
IfAboveAction=...
-
- Developer
- Posts: 22629
- Joined: April 19th, 2009, 11:02 pm
- Location: Fort Hunt, Virginia, USA
Re: how to check is skin activated?
Glad to help. To each his own, but I do recommend considering that plugin for this. Reading the entire Rainmeter.ini file physically from disk and parsing it for the information once a second is a bit brute-force in my view.
-
- Posts: 3
- Joined: August 4th, 2018, 1:08 pm
Re: how to check is skin activated?
My friend, thanks for the recommendations.jsmorley wrote:Glad to help. To each his own, but I do recommend considering that plugin for this. Reading the entire Rainmeter.ini file physically from disk and parsing it for the information once a second is a bit brute-force in my view.
I have already accepted them and use the ConfigActive plugin: https://forum.rainmeter.net/viewtopic.php?p=149824#p149824
It works great and completely solves my needs.
My respect to you and TheAzack9 for the excellent work.