Nesting Variables 入れ子の変数

There may be times when you want to embed or 'nest' variables within variables. This might include any combination of #Variables#, #Built-InVariables#, [SectionVariables] or $MouseVariables$.変数を変数の中に埋め込む、または入れ子にしたい場合があるかもしれません。これは、任意の組み合わせで含まれることがあります##変数を#内蔵InVariables# [SectionVariables]または$ MouseVariables $

So for instance, the goal might be to have things like:たとえば、目標は次のようにすることです。

Text=#MyVar#MyOtherVar##
Text=#MyVar[MyMeasure]#
Text=[MyMeasure#MyVar#]
Text=[MyMeasure[MyOtherMeasure]]

This creates ambiguities that simply can't be reliably parsed and understood by Rainmeter, and can't work.これはあいまいさを生み出します。それは、Rainmeterによって確実に解析され理解されることができず、うまくいくことができません。

Rainmeter solves this by having an alternative form of these variables. These function exactly as their normal counterparts do, but can successfully be nested.

The alternative Nesting Variables syntax代替の入れ子変数の構文

[#VarName]   Replaces: #VarName#
[&MeasureName]   Replaces: [MeasureName]
[$MouseVar]   Replaces: $MouseVar$


So our examples above would look like:したがって、上記の例は次のようになります。

Text=[#MyVar[#MyOtherVar]]
Text=[#MyVar[&MyMeasure]]
Text=[&MyMeasure[#MyVar]]
Text=[&MyMeasure[&MyOtherMeasure]]Text=[#MyVar[#MyOtherVar]]
Text=[#MyVar[&MyMeasure]]
Text=[&MyMeasure[#MyVar]]
Text=[&MyMeasure[&MyOtherMeasure]]

Notes:ノート:

It is not suggested that this in any way deprecates the current style of using variables in your skin. This is an alternative way, that simply allows for nesting to be successful. Use them all the time, or use them just when needed, that is a matter of personal preference.これがスキンで変数を使用する現在のスタイルをなんらかの形で非推奨にすることはお勧めできません。これは代替的な方法で、ネスティングを成功させることができます。それらを常に使用したり、必要なときにだけ使用したりすることは、個人的な好みの問題です。

One difference is that when the Nesting Variables syntax is used in bangs, the values are always dynamically resolved when they are used, including in the [Rainmeter] section of the skin. This is different than the standard #VarName# syntax, which will always require DynamicVariables=1 when the value changes, and can't be dynamic in [Rainmeter]. This difference only applies to use in bangs. When used in option values, DynamicVariables=1 must still be set on the measure or meter if the value changes.1つの違いは、Nesting Variables構文がビッグバンで使用されている場合、値はスキンの[Rainmeter]セクションを含め、使用時に常に動的に解決されることです。これは標準の#VarName#シンタックスとは異なります。標準のシンタックスDynamicVariables=1は値が変わるときに常に必要で、[Rainmeter]では動的にはできません。この違いは前髪での使用にのみ適用されます。オプション値で使用したDynamicVariables=1場合、値が変わった場合でもメジャーまたはメーターに設定する必要があります。

If you are escaping a variable and need to use the nested form, the syntax is:あなたがいる場合は、変数をエスケープし、ネストされたフォームを使用する必要があり、構文は次のとおりです。

[#*VarName*]
[&*MeasureName*]
[#* VarName *]
[&* MeasureName *]

Examples

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

[Variables]
Var1=One
Var2=Two

[MeasureStringOne]
Measure=String
String="I'm the first Measure"

[MeasureStringTwo]
Measure=String
String="I'm the second Measure"

[MeterTest1]
Meter=String
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[&MeasureString[#Var1]]#CRLF#[&MeasureString[#Var2]]
DynamicVariables=1

[MeasureNum3]
Measure=Calc
Formula=3

[MeasureNum4]
Measure=Calc
Formula=4

[MeasureString3]
Measure=String
String="I'm the third Measure"

[MeasureString4]
Measure=String
String="I'm the fourth Measure"

[MeterTest2]
Meter=String
Y=10R
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[&MeasureString[&MeasureNum3]]#CRLF#[&MeasureString[&MeasureNum4]]
DynamicVariables=1
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[MeasureRandom]
Measure=Calc
Formula=Random
LowBound=1
HighBound=5
UpdateRandom=1
UniqueRandom=1

[Measure1]
Measure=String
String="I'm One"

[Measure2]
Measure=String
String="I'm Two"

[Measure3]
Measure=String
String="I'm Three"

[Measure4]
Measure=String
String="I'm Four"

[Measure5]
Measure=String
String="I'm Five"

[MeterTest1]
Meter=String
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=[&Measure[&MeasureRandom]]
DynamicVariables=1
[Rainmeter]
Update=1000
DynamicWindowSize=1
AccurateText=1

[Variables]
XPos1=15
XPos2=10
XPos3=30
XPos4=100
XPos5=0

[MeasureRandom]
Measure=Calc
Formula=Random
LowBound=1
HighBound=5
UpdateRandom=1
UniqueRandom=1

[MeterTest1]
Meter=String
X=[#XPos[&MeasureRandom]]
FontSize=13
FontWeight=400
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1
Text=Hello World
DynamicVariables=1

Download Examples例をダウンロードする

You can download the above examples as a .rmskin.上記の例は.rmskinとしてダウンロードできます。

関連記事

スポンサーリンク

UNION演算子 和集合を計算する

ホームページ製作・web系アプリ系の製作案件募集中です。

上に戻る