It is currently April 19th, 2024, 6:42 am

Expose current zpos of skin though lua

Report bugs with the Rainmeter application and suggest features.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Expose current zpos of skin though lua

Post by death.crafter »

Like SKIN:GetX() and SKIN:GetY(), implement SKIN:GetZ().

It would enable us to easily manipulate relative skin windows. Also, #CURRENTCONFIGZ# would be nice. Well, just #CURRENTCONFIGZ# would work. Especially with AlwaysOnTop skins.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Expose current zpos of skin though lua

Post by jsmorley »

death.crafter wrote: November 13th, 2021, 2:17 pm Like SKIN:GetX() and SKIN:GetY(), implement SKIN:GetZ().

It would enable us to easily manipulate relative skin windows. Also, #CURRENTCONFIGZ# would be nice. Well, just #CURRENTCONFIGZ# would work. Especially with AlwaysOnTop skins.
While there is no built-in way today, and I'm not sure how much value it really is to be honest, there is a work around that can get it.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureZPos]
Measure=WebParser
URL=file://#SETTINGSPATH#Rainmeter.ini
CodePage=1200
RegExp=(?siU)\[#CURRENTCONFIG#\].*AlwaysOnTop=(.*)\r\n
StringIndex=1
DynamicVariables=1

[MeterZPos]
Meter=String
MeasureName=MeasureZPos
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Expose current zpos of skin though lua

Post by death.crafter »

jsmorley wrote: November 13th, 2021, 3:10 pm While there is no built-in way today, and I'm not sure how much value it really is to be honest, there is a work around that can get it.

Code: Select all

[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureZPos]
Measure=WebParser
URL=file://#SETTINGSPATH#Rainmeter.ini
CodePage=1200
RegExp=(?siU)\[#CURRENTCONFIG#\].*AlwaysOnTop=(.*)\r\n
StringIndex=1
DynamicVariables=1

[MeterZPos]
Meter=String
MeasureName=MeasureZPos
FontSize=11
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
I know the workaround, but it's a bit too much to just get the zpos of a skin. Like, it's there and we can get it. So why not?

It can be handy when I have a skin with AlwaysOnTop and I want another addon skin on top of it. Most of the time the main skin's zpos is unknown. So, placing the addon skin correctly is impossible. With zpos exposed, I can set and revert zpos of main skin. Which will be handy, other than placing another measure, which will slow me down.
from the Realm of Death
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Expose current zpos of skin though lua

Post by Active Colors »

death.crafter wrote: November 13th, 2021, 3:31 pm It can be handy when I have a skin with AlwaysOnTop and I want another addon skin on top of it. Most of the time the main skin's zpos is unknown. So, placing the addon skin correctly is impossible. With zpos exposed, I can set and revert zpos of main skin. Which will be handy, other than placing another measure, which will slow me down.
Have you seen LoadOrder? It does what you want
https://docs.rainmeter.net/manual/settings/skin-sections/#LoadOrder
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Expose current zpos of skin though lua

Post by death.crafter »

Active Colors wrote: November 15th, 2021, 8:55 am Have you seen LoadOrder? It does what you want
https://docs.rainmeter.net/manual/settings/skin-sections/#LoadOrder
It doesn't :(

I want my addon to lower the zpos of an arbitrary skin if it is always on top, and then restore it's zpos. But I can't do that unless I read the zpos from Rainmeter settings, which I wish could read from Rainmeter.ini, but it's in UTF-16.
from the Realm of Death
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Expose current zpos of skin though lua

Post by Active Colors »

death.crafter wrote: November 15th, 2021, 10:33 am It doesn't :(

I want my addon to lower the zpos of an arbitrary skin if it is always on top, and then restore it's zpos. But I can't do that unless I read the zpos from Rainmeter settings, which I wish could read from Rainmeter.ini, but it's in UTF-16.
Can you @include=#SETTINGSPATH#Rainmeter.ini in your skin and read it through your skin?
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Expose current zpos of skin though lua

Post by death.crafter »

Active Colors wrote: November 15th, 2021, 10:39 am Can you @include=#SETTINGSPATH#Rainmeter.ini in your skin and read it through your skin?
That's too extreme lol. And how is that even supposed to work. If I @include the setting file, say it's possible, I can't possibly read from it, since that's not how @include works and the sections aren't measures or meters. Or am I wrong?
from the Realm of Death
User avatar
Active Colors
Moderator
Posts: 1251
Joined: February 16th, 2012, 3:32 am
Location: Berlin, Germany

Re: Expose current zpos of skin though lua

Post by Active Colors »

death.crafter wrote: November 15th, 2021, 10:42 am That's too extreme lol. And how is that even supposed to work. If I @include the setting file, say it's possible, I can't possibly read from it, since that's not how @include works and the sections aren't measures or meters. Or am I wrong?
Yeah, I am not sure, that was a very wild guess of me.
Other variants that come to my mind are even more extreme, like to create a copy of Rainmeter.ini then change its encoding and read it with lua.
User avatar
death.crafter
Rainmeter Sage
Posts: 1399
Joined: April 24th, 2021, 8:13 pm

Re: Expose current zpos of skin though lua

Post by death.crafter »

Active Colors wrote: November 15th, 2021, 10:49 am Yeah, I am not sure, that was a very wild guess of me.
Other variants that come to my mind are even more extreme, like to create a copy of Rainmeter.ini then change its encoding and read it with lua.
I have a plugin that can read a file, and I can parse it with lua, but I don't want to, because it is something that should be there.

And to be honest, I would like it if all the setting were exposed through lua. Like SKIN:Settings('SettingName'). Tho, I wonder if that would happen.
from the Realm of Death
User avatar
jsmorley
Developer
Posts: 22629
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Expose current zpos of skin though lua

Post by jsmorley »

Not that I think it's a particularly good idea, but you could use WebParser to just get the entire Rainmeter.ini file with RegExp=(?siU)^(.*)$ and then read the value of the WebParser measure in Lua as you like.

We will look at exposing this value as a built-in Variable.