I try to use a nested Variable and it works perfectly with static Variables. But when i change to Dynamic Variables, only the Value of the second variable is correct. the first variable is written as text.
Text=[#Key1[#lg]] will be "[#Key1<correct value var lg>"
As long as i don't change the Value of the Variable the output is correct (nesting works) as soon as i update the variable, it looks like above. So isn't it possible to work with nested dynamic variables? or is there something i missed?
It is currently April 27th, 2024, 1:44 pm
Dynamic Nested Variables
-
- Posts: 13
- Joined: May 7th, 2019, 6:06 am
-
- Rainmeter Sage
- Posts: 16176
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
-
- Posts: 13
- Joined: May 7th, 2019, 6:06 am
Re: Dynamic Nested Variables
Yes i did. Without it works, but only with static variables. When i add the DynamicVariables=1 then it works only as long as the variable isn't update.
-
- Rainmeter Sage
- Posts: 16176
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Dynamic Nested Variables
Please post the code.
-
- Posts: 13
- Joined: May 7th, 2019, 6:06 am
Re: Dynamic Nested Variables
This is the code:
When i comment the onUpdateAction, then it works, but when i update it with the action, the nesting doesn't work anymore. The Lua Script reads the content from ActLang. ActLang contains same as Lg Variable (at the moment). SO i can see the correct value in the textfield.
Code: Select all
[Rainmeter]
; This section contains general settings that can be used to change how Rainmeter behaves.
Update=1000
[Variables]
Width=200
Height=30
Key1=Key1
Key1_D="Hallo Welt"
Key1_E="Hello World"
Lg="_E"
; ----------------------------------
; STYLES are used to "centralize" options
; ----------------------------------
[StyleTitle]
StringStyle=Bold
FontColor=0,255,255,255
SolidColor=255,255,0,255
FontSize=16
AntiAlias=1
; ----------------------------------
; Measures
; ----------------------------------
[MeasureLang]
Measure=Script
ScriptFile=#CURRENTPATH#LuaTextFile.lua
FileToRead=#CURRENTPATH#ActLang
onUpdateAction=[!SetVariable Lg "[MeasureLang]"]
[MeterText]
Meter=String
MeasureName=MeasureLang
W=#Width#
H=#Height#
x=0r
y=0R
MeterStyle=StyleTitle
DynamicVariables=1
Text=[#Key[#lg]]
;-------------------------------------------------------
Last edited by balala on May 17th, 2019, 3:18 pm, edited 1 time in total.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
Reason: Please use <code> tags whenever are you posting code snippets. It's the </> button.
-
- Rainmeter Sage
- Posts: 16176
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Dynamic Nested Variables
I can't test the code, because I don't have the code of the ActLang file (additionally still don't think omiting the extension is a good idea), but what I see is the following detail: beside the _D or _E termination, the KeyXX variables have a number as well. This is missing in your code: applying the posted code, I don't get anything working, even if I comment out the OnUpdateAction option of the [MeasureLang] measure (in a such case I get [#Key_E] on the String meter). As you can see, the number is missing.past105 wrote: ↑May 17th, 2019, 1:56 pm When i comment the onUpdateAction, then it works, but when i update it with the action, the nesting doesn't work anymore. The Lua Script reads the content from ActLang. ActLang contains same as Lg Variable (at the moment). SO i can see the correct value in the textfield.
If on the other hand I add a Num=1 variable to the [Variables] section and modify the Text option of the [MeterText] meter to Text=[#Key[#Num][#lg]], I get exactly what it's needed: Hello World.
As I said, unfortunately I can't test the code deeper, because I still don't have all needed files (like ActLang or LuaTextFile.lua - however the .lua file probably was posted once - are you the same guy as oioo?).
For a much more specific help, please pack the content of the whole config and upload the file here. This would be needed to have all needed files.
-
- Posts: 13
- Joined: May 7th, 2019, 6:06 am
Re: Dynamic Nested Variables
Sorry was away during the weekend
You're right, the 1 is missing. probably i deleted it after copying it. but normaly it is there. i attached you the whole code with the lua file. I'm not Oioo, but i took the lua code from this forum. Was a bit faster than to code it again.
So tho attachment should contain everything to start the skin and shows you what i mean.
You're right, the 1 is missing. probably i deleted it after copying it. but normaly it is there. i attached you the whole code with the lua file. I'm not Oioo, but i took the lua code from this forum. Was a bit faster than to code it again.
![Whistle :Whistle](./images/smilies/whistling.gif)
So tho attachment should contain everything to start the skin and shows you what i mean.
You do not have the required permissions to view the files attached to this post.
-
- Rainmeter Sage
- Posts: 16176
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania
Re: Dynamic Nested Variables
Yep, I see and found that actually there is an issue in the ActLang file. The string shown by the [MeterText] meter isn't in fact [#Key1_E], but:
Code: Select all
[#Key1_E
]
If you remove that new line, keeping just _E into its content, the code works, showing Hello World.
-
- Posts: 13
- Joined: May 7th, 2019, 6:06 am
Re: Dynamic Nested Variables
What a shame.
Now i understand the little line under the text. my window was just a bit too narrow to see my mistake. Thanks for your time!
![Embarrassed :oops:](./images/smilies/ah.gif)
-
- Rainmeter Sage
- Posts: 16176
- Joined: October 11th, 2010, 6:27 pm
- Location: Gheorgheni, Romania