It is currently October 9th, 2024, 6:30 pm

Help | Resizable Skin

Get help with creating, editing & fixing problems with skins
RicardoTM
Posts: 332
Joined: December 28th, 2022, 9:30 pm
Location: México

Help | Resizable Skin

Post by RicardoTM »

Well, here I am again..

So I am trying to make my gauge resizable, I'm using the formulas used in this skin: https://www.deviantart.com/osricwuscfrea/art/Photos-1-0-574947616

I actually managed to make it resizable, but my problem is that it won't adjust the text accordingly to the gauge's size.

Here's the code:

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1


[Metadata]
Name= GPUGauge
Author= RicardoTM
Information= A Gauge trying to be resizable
Version= 0.3
License=Creative Commons Attribution - Non - Commercial - Share Alike 3.0

[Variables]
GPUTempIndex=9

;Gauge Size - default size, so 170 means the meter starts off at 340 x 340 pixels.
GaugeSize=170

;The amount gauge grows or shrinks when scrolling mouse in pixels
ScrollMouseIncrement=10

[StyleText]
StringAlign=Center
StringStyle=Bold
StringEffect=Shadow
FontColor=225,225,225
FontEffectColor=0,0,0,
AntiAlias=1

[MeasureGPUTempValueRaw]
Measure=Registry
RegHKey=HKEY_CURRENT_USER
RegKey=SOFTWARE\HWINFO64\VSB
RegValue=ValueRaw#GPUTempIndex#

[MeasureGPUTempValueOf15]
Measure=Calc
Formula=([MeasureGPUTempValueRaw]/(130/16))
DynamicVariables=1


[MeterGauge0]
Meter=Image
ImageName=#@#Images\states\[MeasureGPUTempValueof15:0].png
PreserveAspectRatio=1
UseExifOrientation=1
H=(#GaugeSize#)*2
W=(#GaugeSize#)*2
X=0
Y=0
MouseScrollDownAction=[!SetVariable GaugeSize "(#GaugeSize#-#ScrollMouseIncrement# < 90 ? 90 : #GaugeSize#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables GaugeSize "(#GaugeSize#-#ScrollMouseIncrement# < 90 ? 90 : #GaugeSize#-#ScrollMouseIncrement#)"][!UpdateMeter *][!UpdateMeasure *][!Redraw]
MouseScrollUpAction=[!SetVariable GaugeSize "(#GaugeSize#+#ScrollMouseIncrement# > 170 ? 170 : #GaugeSize#+#ScrollMouseIncrement#)"] [!WriteKeyValue Variables GaugeSize "(#GaugeSize#+#ScrollMouseIncrement# > 170 ? 170 : #GaugeSize#+#ScrollMouseIncrement#)"][!UpdateMeasure *][!UpdateMeter *][!Redraw]
DynamicVariables=1

[MeterText]
Meter=String
MeterStyle=StyleText
x=(#GaugeSize#)*1
y=(#GaugeSize#)-30
Text=[MeasureGPUTempValueRaw:0]
FontSize=(#GaugeSize#)*0.235
fontName=HelveticaNeueLT Std
DynamicVariables=1

[MeterTextGpu]
Meter=String
MeterStyle=StyleText
x=(#GaugeSize#)*1
y=(#GaugeSize#)+70
Text=GPU
FontSize=(#GaugeSize#)*0.165
fontName=HelveticaNeueLT Std
DynamicVariables=1
Here's the package in case you want to take a closer look.
Resizable Gauge_0.3.rmskin
Thank you in advance.
You do not have the required permissions to view the files attached to this post.
Last edited by RicardoTM on December 29th, 2022, 10:31 pm, edited 1 time in total.
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help | Resizable Skin

Post by balala »

RicardoTM wrote: December 29th, 2022, 7:32 pm So I am trying to make my gauge resizable,
How are you trying to make it resizable, because I can't realize? I don't find any variable which could be used to resize the skins. Am I missing something?

A comment related to both skins included into the uploaded package. This has nothing to do with your question, however you should take it into account. The Update of skins are expressed in milliseconds. So the used Update=1 is a completely wrong value. In fact I assume you meant an update of 1 second, but as said, the Update is expressed in milliseconds, so Update=1 means 1 millisecond, so 1000 updates per second. Well, this is not entirely true, because the lowest possible value of Update is Update=16. If you're using a lower value, the skin works with Update=16, but even this is too much (or too little).
RicardoTM
Posts: 332
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help | Resizable Skin

Post by RicardoTM »

balala wrote: December 29th, 2022, 8:15 pm How are you trying to make it resizable, because I can't realize? I don't find any variable which could be used to resize the skins. Am I missing something?
If you check the skin I posted from deviantart, it resizes when scrolling, I managed to do the same to my gauge skin by using part of the code:

Code: Select all

;Gauge Size - default size, so 170 means the meter starts off at 340 x 340 pixels.
GaugeSize=170

;The amount gauge grows or shrinks when scrolling mouse in pixels
ScrollMouseIncrement=10
And

Code: Select all

MouseScrollDownAction=[!SetVariable GaugeSize "(#GaugeSize#-#ScrollMouseIncrement# < 90 ? 90 : #GaugeSize#-#ScrollMouseIncrement#)"][!WriteKeyValue Variables GaugeSize "(#GaugeSize#-#ScrollMouseIncrement# < 90 ? 90 : #GaugeSize#-#ScrollMouseIncrement#)"][!UpdateMeter *][!UpdateMeasure *][!Redraw]
MouseScrollUpAction=[!SetVariable GaugeSize "(#GaugeSize#+#ScrollMouseIncrement# > 170 ? 170 : #GaugeSize#+#ScrollMouseIncrement#)"] [!WriteKeyValue Variables GaugeSize "(#GaugeSize#+#ScrollMouseIncrement# > 170 ? 170 : #GaugeSize#+#ScrollMouseIncrement#)"][!UpdateMeasure *][!UpdateMeter *][!Redraw]
The problem is that the text doesn't stick to it 🤷🏽‍♂️
A comment related to both skins included into the uploaded package.
I only did it while testing the gauge because 1 second was too long for it to update lol, I already reversed it to 1000ms 😛
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5539
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help | Resizable Skin

Post by eclectic-tech »

To have the text adjust with the Image size, use section variables of the width and height of the image meter [MeterGauge0] with a fractional multiplier. I set the X multiplier value to half the image width and a bit more or less for the Y position of the text.

Because you are controlling the size of the image, you do not need to adjust the X & Y with the 'Gauge' variable. They are repositioned based on the image meter width, height, and multipliers automatically.

Replace the string meters with these:

Code: Select all

[MeterText]
Meter=String
MeterStyle=StyleText
x=([MeterGauge0:W]*0.5)
y=([MeterGauge0:H]*0.42)
Text=[MeasureGPUTempValueRaw:0]
FontSize=(#GaugeSize#)*0.235
fontName=HelveticaNeueLT Std
DynamicVariables=1

[MeterTextGpu]
Meter=String
MeterStyle=StyleText
x=([MeterGauge0:W]*0.5)
y=([MeterGauge0:H]*0.71)
Text=GPU
FontSize=(#GaugeSize#)*0.165
fontName=HelveticaNeueLT Std
DynamicVariables=1
You can play with the section variable multipliers if the text alignment needs to be changed.
RicardoTM
Posts: 332
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help | Resizable Skin

Post by RicardoTM »

eclectic-tech wrote: December 29th, 2022, 9:18 pm To have the text adjust with the Image size, use section variables of the width and height of the image meter [MeterGauge0] with a fractional multiplier. I set the X multiplier value to half the image width and a bit more or less for the Y position of the text.

Because you are controlling the size of the image, you do not need to adjust the X & Y with the 'Gauge' variable. They are repositioned based on the image meter width, height, and multipliers automatically.

Replace the string meters with these:

Code: Select all

[MeterText]
Meter=String
MeterStyle=StyleText
x=([MeterGauge0:W]*0.5)
y=([MeterGauge0:H]*0.42)
Text=[MeasureGPUTempValueRaw:0]
FontSize=(#GaugeSize#)*0.235
fontName=HelveticaNeueLT Std
DynamicVariables=1

[MeterTextGpu]
Meter=String
MeterStyle=StyleText
x=([MeterGauge0:W]*0.5)
y=([MeterGauge0:H]*0.71)
Text=GPU
FontSize=(#GaugeSize#)*0.165
fontName=HelveticaNeueLT Std
DynamicVariables=1
You can play with the section variable multipliers if the text alignment needs to be changed.
Pfff man, I swear you're a god! Thank you!

Where can I read more about this?

Code: Select all

x=([MeterGauge0:W]*0.5)
y=([MeterGauge0:H]*0.71)
balala wrote: December 29th, 2022, 8:15 pm The Update of skins are expressed in milliseconds. So the used Update=1 is a completely wrong value. In fact I assume you meant an update of 1 second, but as said, the Update is expressed in milliseconds, so Update=1 means 1 millisecond, so 1000 updates per second. Well, this is not entirely true, because the lowest possible value of Update is Update=16. If you're using a lower value, the skin works with Update=16, but even this is too much (or too little).
Btw, in the clock I changed it to 1ms because it was updating 1 second after my pc's clock, and that was a pain in my heart lol now I didn't know 16ms were the lowest possible, that explains why it isn't perfect lol
User avatar
eclectic-tech
Rainmeter Sage
Posts: 5539
Joined: April 12th, 2012, 9:40 pm
Location: Cedar Point, Ohio, USA

Re: Help | Resizable Skin

Post by eclectic-tech »

You can find out more about Section Variables in the documentation.
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help | Resizable Skin

Post by balala »

RicardoTM wrote: December 29th, 2022, 10:31 pm Btw, in the clock I changed it to 1ms because it was updating 1 second after my pc's clock, and that was a pain in my heart lol now I didn't know 16ms were the lowest possible, that explains why it isn't perfect lol
For most skins, like clocks and calendars for instance, doesn't really worth to use lower Update than the default Update=1000, especially because these skins are showing some information which are not changing more frequently than once per second.. The delay you're talking about is caused by how Rainmeter does work. When the time is changing, the skin gets this change, causing the update of appropriate Time measure, then the String or whatever meter is showing the result of the Time measure and finally it redraws the skin on the screen. But this happens only after 1 update cycle, which for skins using the default Update=1000 option is 1 second and is caused by what has been described above. This is why you see like the clock is updated one second later than the clock of your computer. For most users this is not a problem, doesn't really matter if the skin is changing the clock right in same time with the clock of computer or one second later. Using a low Update can heavily load the computer (even a modern one), which simply doesn't really worth.

I hope eclectic-tech fixed your issue, right?
RicardoTM
Posts: 332
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help | Resizable Skin

Post by RicardoTM »

balala wrote: December 30th, 2022, 3:55 pm Using a low Update can heavily load the computer (even a modern one), which simply doesn't really worth.
Well, my pc is fine for now with the clock having a fast update, if something gets bad i'll change it, thank you for the info!
balala wrote: December 30th, 2022, 3:55 pmI hope eclectic-tech fixed your issue, right?
Sure he did! The resizable gauge is working beautifully now! But I have another problem haha if you don't mind me asking about it here...

Is it possible to make two or more skins move together? I know ctrl + alt + click will do, but I want them to always move together, I made a little pop-up window that opens/closes when double clicking the gauge, but I want it to stick to the gauge, so no matter where you put the gauge, if you double click it the window pops-up under the gauge and would move with it. I thought that would be possible with groups, but nope, not possible..

Any idea how can I do it?

Heres the gauge
SharedScreenshot3.jpg
double click it and window opens
SharedScreenshot2.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
balala
Rainmeter Sage
Posts: 16645
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Help | Resizable Skin

Post by balala »

RicardoTM wrote: December 30th, 2022, 5:41 pm Sure he did! The resizable gauge is working beautifully now!
:thumbup:

RicardoTM wrote: December 30th, 2022, 5:41 pm But I have another problem haha if you don't mind me asking about it here...

Is it possible to make two or more skins move together? I know ctrl + alt + click will do, but I want them to always move together, I made a little pop-up window that opens/closes when double clicking the gauge, but I want it to stick to the gauge, so no matter where you put the gauge, if you double click it the window pops-up under the gauge and would move with it. I thought that would be possible with groups, but nope, not possible..

Any idea how can I do it?
I hope eclectic-tech doesn't mind if I reply now to this question.
A Rainmeter skin has no idea about the position (size, etc) of other skins, so the first reply is that this can't be done. However there is a trick, which might help.
You have to add the following measure to the skin you want to be "followed" by the other one:

Code: Select all

[MeasurePos]
Measure=Calc
OnUpdateAction=[!SetWindowPosition "(#CURRENTCONFIGX#+#CURRENTCONFIGWIDTH#/2)" "(#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#)" "50%" "0%" "FOLLOWER-CONFIG"][!ShowFade "FOLLOWER-CONFIG"][!Delay "5000"][!HideFade "FOLLOWER-CONFIG"]
DynamicVariables=1
UpdateDivider=-1
Note the last two options, which both are extremely important here: DynamicVariables=1 and UpdateDivider=-1. The first one is needed because some variables used into the OnUpdateAction option require it, while the second one is needed because we don't want to get the bangs of the OnUpdateAction option executed once per second (or how the Update of the skin is set - this is the most probable update). With such an option, you're ensuring that the bangs are executed once when the skin is loaded / refreshed, and later only when required (see below).
Make sure you're replacing the FOLLOWER-CONFIG parameter with the config name of skin which has to follow the first one (hope you know what does this mean, if you don't it know, please let us know). Also take a look to the used bangs:
  • The first bang (!SetWindowPosition) sets the position of the second skin (the one which has the config specified as last parameter of the bang, namely FOLLOWER-CONFIG). Horizontally this position is set to half of the current skin ((#CURRENTCONFIGX#+#CURRENTCONFIGWIDTH#/2) - so the X position of this skin, plus half of its width), while vertically below the current skin ((#CURRENTCONFIGY#+#CURRENTCONFIGHEIGHT#) - the vertical position of skin, added by its height - if needed you can add here a constant, to get the skin even lower). The anchor point of the follower skin is set to 50% horizontally (its middle) and to 0% (which is its upper edge).
  • [!ShowFade "FOLLOWER-CONFIG"] shows up the second skin, assuming it is hidden.
  • [!Delay "5000"] is the delay between the execution of bangs preceding this bang and the one following it. This bang is keeping the skin visible for 5000 milliseconds = 5 seconds (see the last bangs as well).
  • Finally the [!HideFade "FOLLOWER-CONFIG"] bang hides the follower skin, after the amount of time set by the previous !Delay bang.
And finally add the following option to the [Rainmeter] section of your first skin, to get the above bangs executed when you double click the current skin: LeftMouseDoubleClickAction=[!UpdateMeasure "MeasurePos"]

I hope I understood well your intention. Anyway the above !SetWindowPosition bang sets the position of second skin, this is the most important for you, I assume. Note that the second skin HAS TO BE activated in order not to take error messages in the log.
Is this what you wanted to achieve?
RicardoTM
Posts: 332
Joined: December 28th, 2022, 9:30 pm
Location: México

Re: Help | Resizable Skin

Post by RicardoTM »

Thank you for your reply! I've been trying to implement the code but I might be doing something wrong, either way, to make sure we are at the same page;
Currently, this is how my skin works: I have a Gauge which is the main skin, the gauge shows me only the GPU temperature, which is my main concern, so, If I want to take a look at the other gpu sensors, I double click the gauge and a sensor list skin loads, if for some reason I want to check all the other stuff, I double click the sensor list skin to open HWINFO64.exe. To close the sensor list I can either double click the gauge again or left click in the little blue circle in the sensor list. That's what I have so far and works perfectly.

Now I want the list skin to follow the gauge skin movement so if I move the gauge to somewhere else, the list will follow.

What I'm not so sure about is this
balala wrote: December 30th, 2022, 7:23 pm And finally add the following option to the [Rainmeter] section of your first skin, to get the above bangs executed when you double click the current skin: LeftMouseDoubleClickAction=[!UpdateMeasure "MeasurePos"]
I'm already using LeftMouseDoubleClickAction=[!ToggleConfig " "] in the gauge to load and unload the sensor list and also I'm using it to open hwinfo64 in the sensor list (LeftMouseDoubleClickAction=[#HWINFO64]).

So, If I use LeftMouseDoubleClickAction=[!UpdateMeasure "MeasurePos"] in the gauge skin it would conflict with LeftMouseDoubleClickAction=[!ToggleConfig] doesn't it?

Here's the package if you want to take a look. Only load the gauge and double click it to load the list.
RTM Gauge V2_0.3.rmskin
(this package doesn't have the code you gave me in it)

Thank you again!
You do not have the required permissions to view the files attached to this post.