It is currently March 29th, 2024, 2:06 pm

Can't seem to create a working dynamic variable.

Get help with creating, editing & fixing problems with skins
Insy
Posts: 4
Joined: July 13th, 2018, 6:12 pm

Can't seem to create a working dynamic variable.

Post by Insy »

Hello there! Very new to the forums but after reading through a couple posts dealing with variables / dynamic variables I didn't get any closer to a resolution to the problem I'm having. My skin is pretty simple, just a bunch of text labels that launch associated programs. I was originally setting each label's Y position in the MeterStyle with Y=0R so they would stack nicely. The issue with that is when they grow on mouseover they "push" lower labels down. I would rather Have a variable "ypos" that starts at 0 and after each meter is drawn (?) set ypos to (ypos+10) or something similar.

I'll post my code in it's current form which is not complete and a little messy (I don't think Group=Labels is even doing anything)

I attempted to use the variable ypos in [Variables] and after not getting it to function tried to use a measure instead.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
ypos=0

[YPos]
Measure=Calc
Formula=50

[Outlook]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Outlook
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"]
Y=#ypos#

[!SetVariable ypos "#ypos#+50"]

[Connectwise]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Connectwise
LeftMouseUpAction=["C:\Program Files (x86)\ConnectWise\PSA.net\ConnectWise.exe"]
Y=[YPos]

[Excel]
Meter=String
Group=Labels
MeterStyle=Label
Text=Excel
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"]

[Word]
Meter=String
Group=Labels
MeterStyle=Label
Text=Word
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"]

[Teamviewer]
Meter=String
Group=Labels
MeterStyle=Label
Text=Teamviewer
LeftMouseUpAction=["C:\Program Files (x86)\TeamViewer\TeamViewer.exe"]

[Discord]
Meter=String
Group=Labels
MeterStyle=Label
Text=Discord
LeftMouseUpAction=["C:\Users\codym\AppData\Local\Discord\app-0.0.301\Discord.exe"]

[Label]
Meter=String
SolidColor=0,0,0,1
FontColor="255,255,255,255"
FontFace=Spectral SC Light
FontSize=17
AntiAlias=1
StringEffect=Shadow
FontEffectColor=0,0,0,255
H=30
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "23,148,228,255"] [!SetOption #CURRENTSECTION# FontSize 25] [!SetOption #CURRENTSECTION# H 50] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "255,255,255,255"] [!SetOption #CURRENTSECTION# FontSize 20][!SetOption #CURRENTSECTION# H 30] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
Last edited by Insy on July 13th, 2018, 8:41 pm, edited 2 times in total.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't seem to create a working dynamic variable.

Post by balala »

Insy wrote:Hello there! Very new to the forums but after reading through a couple posts dealing with variables / dynamic variables I didn't get any closer to a resolution to the problem I'm having. My skin is pretty simple, just a bunch of text labels that launch associated programs. I was originally setting each label's Y position in the MeterStyle with Y=0R so they would stack nicely. The issue with that is when they grow on mouseover they "push" lower labels down. I would rather Have a variable "ypos" that starts at 0 and after each meter is drawn (?) set ypos to (ypos+10) or something similar.

I'll post my code in it's current form which is not complete and a little messy (I don't think Group=Labels is even doing anything)

I attempted to use the variable ypos in [Variables] and after not getting it to function tried to use a measure instead.
I think you've messed up something, because for me at least all those String meters overlaps each other. Looking to your code, this seems normal, because neither the [Excel], nor the [Word], [Teamviewer] or the [Discord] meter doesn't have an Y option, which should have to be used to position the meter vertically. A such option isn't set neither on the [Label] meter style section.
So all these meters are using the default vertical position (Y=0).
Now I suppose you wanted to add a Y=0R option to the [Label] section. Did you wanted to add it?
Insy
Posts: 4
Joined: July 13th, 2018, 6:12 pm

Re: Can't seem to create a working dynamic variable.

Post by Insy »

Hi! Thanks for the reply and sorry if I wasn't very clear. I'm aware that in its current form the code writes all the labels to the same position. I want this position to be controlled by a variable. I'd rather not use relative positioning because when the labels grow in size they change the position of subsequent labels. If they have static Y positions then only the label being moused over will move. I've tried to write something like this.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Variables]
ypos=0

[Outlook]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Outlook
Y=#ypos#
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"]

[!SetVariable ypos "ypos+20"]

[Connectwise]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Connectwise
Y=#ypos#
LeftMouseUpAction=["C:\Program Files (x86)\ConnectWise\PSA.net\ConnectWise.exe"]

[!SetVariable ypos "ypos+20"]

[Excel]
Meter=String
Group=Labels
MeterStyle=Label
Text=Excel
Y=#ypos#
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"]

[!SetVariable ypos "ypos+20"]

[Word]
Meter=String
Group=Labels
MeterStyle=Label
Text=Word
Y=#ypos#
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"]

[!SetVariable ypos "ypos+20"]

[Teamviewer]
Meter=String
Group=Labels
MeterStyle=Label
Text=Teamviewer
Y=#ypos#
LeftMouseUpAction=["C:\Program Files (x86)\TeamViewer\TeamViewer.exe"]

[!SetVariable ypos "ypos+20"]

[Discord]
Meter=String
Group=Labels
MeterStyle=Label
Text=Discord
Y=#ypos#
LeftMouseUpAction=["C:\Users\codym\AppData\Local\Discord\app-0.0.301\Discord.exe"]

[!SetVariable ypos "ypos+20"]

[Label]
Meter=String
SolidColor=0,0,0,1
FontColor="255,255,255,255"
FontFace=Spectral SC Light
FontSize=17
AntiAlias=1
StringEffect=Shadow
FontEffectColor=0,0,0,255
H=30
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "23,148,228,255"] [!SetOption #CURRENTSECTION# FontSize 25] [!SetOption #CURRENTSECTION# H 50] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "255,255,255,255"] [!SetOption #CURRENTSECTION# FontSize 20][!SetOption #CURRENTSECTION# H 30] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
If I can get something similar to this working then I can try to move the option Y=#ypos# to the MeterStyle to cut out a few lines of code. There will eventually be more labels.

In other words it should behave like the following code but without having to manually enter the Y values.

Code: Select all

[Rainmeter]
Update=1000
AccurateText=1

[Outlook]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Outlook
Y=0
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE"]

[Connectwise]
Meter=String
Group=Labels
MeterStyle=Label
DynamicVariables=1
Text=Connectwise
Y=20
LeftMouseUpAction=["C:\Program Files (x86)\ConnectWise\PSA.net\ConnectWise.exe"]

[Excel]
Meter=String
Group=Labels
MeterStyle=Label
Text=Excel
Y=40
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\EXCEL.EXE"]

[Word]
Meter=String
Group=Labels
MeterStyle=Label
Text=Word
Y=60
LeftMouseUpAction=["C:\Program Files (x86)\Microsoft Office\root\Office16\WINWORD.EXE"]

[Teamviewer]
Meter=String
Group=Labels
MeterStyle=Label
Text=Teamviewer
Y=80
LeftMouseUpAction=["C:\Program Files (x86)\TeamViewer\TeamViewer.exe"]

[Discord]
Meter=String
Group=Labels
MeterStyle=Label
Text=Discord
Y=100
LeftMouseUpAction=["C:\Users\codym\AppData\Local\Discord\app-0.0.301\Discord.exe"]

[Label]
Meter=String
SolidColor=0,0,0,1
FontColor="255,255,255,255"
FontFace=Spectral SC Light
FontSize=17
AntiAlias=1
StringEffect=Shadow
FontEffectColor=0,0,0,255
H=30
MouseOverAction=[!SetOption #CURRENTSECTION# FontColor "23,148,228,255"] [!SetOption #CURRENTSECTION# FontSize 25] [!SetOption #CURRENTSECTION# H 50] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
MouseLeaveAction=[!SetOption #CURRENTSECTION# FontColor "255,255,255,255"] [!SetOption #CURRENTSECTION# FontSize 20][!SetOption #CURRENTSECTION# H 30] [!UpdateMeter #CURRENTSECTION#] [!Redraw]
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't seem to create a working dynamic variable.

Post by balala »

Insy wrote:I'd rather not use relative positioning because when the labels grow in size they change the position of subsequent labels.
Not necessarily. If you're using relative positioning, but instead of the instead of the Y=0R, you add something like Y=20r (lowercase r, instead of uppercase R), this won't happen.
Insy
Posts: 4
Joined: July 13th, 2018, 6:12 pm

Re: Can't seem to create a working dynamic variable.

Post by Insy »

Thank you so much. I somehow missed this entire section in the manual.
Relative positioning: If the value is appended with r, the position is relative to the top/left edge of the previous meter. If the value is appended with R, the position is relative to the bottom/right edge of the previous meter.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't seem to create a working dynamic variable.

Post by balala »

Insy wrote:Thank you so much. I somehow missed this entire section in the manual.
But have you got it working now as intended?
Insy
Posts: 4
Joined: July 13th, 2018, 6:12 pm

Re: Can't seem to create a working dynamic variable.

Post by Insy »

Yes, it is now working correctly.
User avatar
balala
Rainmeter Sage
Posts: 16110
Joined: October 11th, 2010, 6:27 pm
Location: Gheorgheni, Romania

Re: Can't seem to create a working dynamic variable.

Post by balala »

Insy wrote:Yes, it is now working correctly.
:thumbup: