IfConditions

IfCondition options are used in any measure, of any type, to evaluate a mathematical formula. The formula will be evaluated as "true" or "false", and will execute IfTrueAction or IfFalseAction action options, which will contain one or more Bangs or commands.IfConditionオプションは、数式を評価するために、あらゆるタイプのあらゆるメジャーで使用されます。式は "true"または "false"として評価され、IfTrueActionまたはIfFalseAction アクションオプションを実行します。これらには1つ以上のBangsまたはコマンドが含まれます。

Note: IfCondition can only be used to evaluate a numeric mathematical formula. No string values may be used in the condition test. See IfMatchActions to test and take action on string values.注: IfConditionは、数式の評価にのみ使用できます。条件テストでは文字列値を使用できません。文字列値をテストして対処するには、IfMatchActionsを参照してください。

The formula uses the same syntax as described on the Formulas page but does not need to be surrounded in parenthesis. Like the Calc measure, measure names do not need [brackets] and are always dynamic when referenced inside the IfCondition.式は、「式」ページで説明したものと同じ構文を使用しますが、括弧で囲む必要はありません。Calcメジャーと同様に、メジャー名は[大括弧]を必要とせず、IfCondition内で参照されるときは常に動的です。

There can be multiple sets of condition and action options in the measure, by using IfCondition2 / IfTrueAction2 / IfFalseAction2 and so on.IfCondition2 / IfTrueAction2 / IfFalseAction2などを使用して、メジャーに複数の条件およびアクションオプションのセットを含めることができます。

IfConditions are similar in functionality to IfActions, with a few important and powerful differences.IfConditionsは、機能的に似ているIfActionsいくつかの重要で強力な違いが、。

  • The formula is not based on the value of the measure the IfCondition is in, but can reference any measures, variables or section variables.式は、IfConditionが存在する数値データの値に基づいていませんが、任意の数値データ、変数、またはセクション変数を参照できます。
  • There can be an IfTrueAction, IfFalseAction or both for each IfCondition, so you can take appropriate actions not only when the result is "true", but also when it is "false".IfConditionごとにIfTrueAction、IfFalseAction、またはその両方が存在する可能性があるため、結果が「true」の場合だけでなく、それが「false」の場合も適切なアクションを実行できます。
  • The syntax allows for a single IfCondition to embed logical AND && and OR || comparisons in the formula. Unlike IfEqualValue for instance, which allows for a single comparison, you could use IfCondition=(MeasureName = 5) || (MeasureName = 10), to check if the value of MeasureName is "5" OR "10". You can also use the full range of logical operators, so rather than being limited to "equal", "above" or "below", you can use any of <> = < > <= >= && ||.この構文では、単一のIfConditionで論理式のAND &&とORの||比較を式に埋め込むことができます。例えばIfEqualValueは、単一の比較を可能にしますがIfCondition=(MeasureName = 5) || (MeasureName = 10)、MeasureNameの値が "5"か "10"かをチェックするために使用できます。論理演算子の全範囲を使用することもできます。したがって、 "等しい"、 "上"、 "下"に限定されるのではなく、いずれかを使用できます<> = < > <= >= && ||

Optionsオプション

IfCondition, IfCondition2, ..., IfConditionNIfConditionIfCondition2、...、IfConditionN

A mathematical formula, which when evaluated will result in "true" or "false".評価されると「true」または「false」になる数式。

Examples:例:

IfCondition=MeasureName >= 10

IfCondition=MeasureOne = (MeasureTwo + #VarName#) / 2

IfCondition=(MeasureName > 5) && (MeasureName < 10)IfCondition=(MeasureName > 5) && (MeasureName < 10)

IfCondition=(MeasureName = 25) || (MeasureName = 50) || (MeasureName = 75)

Note: The comparison on either side of logical AND && and OR || operators must be enclosed in (parentheses).注:論理AND &&およびOR ||演算子の両側の比較は(括弧)で囲む必要があります。

IfTrueAction, IfTrueAction2, ..., IfTrueActionNIfTrueActionIfTrueAction2、...、IfTrueActionN

Optional action to be executed when the formula expressed in IfCondition results in "true". The action is executed only once when the condition becomes "true", so it needs to become "false" and again "true" to execute again.IfConditionで表される式が "true"になったときに実行されるオプションのアクション。アクションは、条件が「true」になったときに一度だけ実行されるため、「false」になり、再度実行するには「true」になる必要があります。

IfFalseAction, IfFalseAction2, ..., IfFalseActionNIfFalseActionIfFalseAction2、...、IfFalseActionN

Optional action to be executed when the formula expressed in IfCondition results in "false". The action is executed only once when the condition becomes "false", so it needs to become "true" and again "false" to execute again.IfConditionで表される式が "false"になったときに実行されるオプションのアクション。アクションは、条件が「偽」になったときに一度だけ実行されるので、再度実行するには「真」になり、再び「偽」になる必要があります。

IfConditionMode Default: 0IfConditionMode デフォルト: 0

If set to 1, the evaluation of the condition will execute the appropriate actions in IfTrueAction or IfFalseAction on every update of the measure.に設定されている場合1、条件の評価はメジャーが更新されるたびにIfTrueActionまたはIfFalseActionで適切なアクションを実行します。

Note: Care should be taken not to create an infinite loop in the actions. In particular, !Refresh, !Update and !UpdateMeasure #CURRENTSECTION# should generally be avoided when IfConditionMode=1.注:アクションに無限ループを作成しないように注意する必要があります。特に、!Refresh!Updateおよび!UpdateMeasure #CURRENTSECTION#一般たときに避けるべきですIfConditionMode=1

Example

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

[MeasureCPU]
Measure=CPU
IfCondition=MeasureCPU < 10
IfTrueAction=[!SetOption MeterCPU Text "CPU usage is less than 10 percent"]
IfCondition2=(MeasureCPU >= 10) && (MeasureCPU <= 90)
IfTrueAction2=[!SetOption MeterCPU Text "CPU usage is between 10 and 90 percent"]
IfCondition3=MeasureCPU > 90
IfTrueAction3=[!SetOption MeterCPU Text "CPU usage is more than 90 percent!"]
OnUpdateAction=[!UpdateMeter MeterCPU][!Redraw]

[MeterCPU]
Meter=String
FontSize=12
FontColor=255,255,255,255
SolidColor=47,47,47,255
Padding=5,5,5,5
AntiAlias=1

関連記事

スポンサーリンク

SELECT データの抽出・問い合わせ・クエリー

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

上に戻る