System システム

Introduction前書き

With this tutorial, we are going to cover several things. First, we are going to introduce two new measure and two new meter types, as well as some new options for controlling how they work. We will also touch on the use of UpdateDivider on measures to control the performance of a skin, and will explore using Variables to set, use and change values shared by measures and meters.このチュートリアルでは、いくつかのことを説明します。まず、2つの新しいメジャーと2つの新しいメーターの種類、およびそれらの機能を制御するためのいくつかの新しいオプションを紹介します。また、スキンのパフォーマンスを制御するためのメジャーでのUpdateDividerの使用にも触れ、メジャーとメーターによって共有される値を設定、使用、および変更するための変数の使用を検討します。

There is a lot going on in this skin, so let's explore the end-result a bit so you can get a sense of where we are going as we work through it. First, let's take a look at the final skin.このスキンにはたくさんのことが起こっているので、最終結果を少し調べてみましょう。そうすれば、作業中にどこに向かっているのかがわかります。まず、最後のスキンを見てみましょう。

What we are going to do is measure the percent usage of the CPU, and the space on a couple of hard drives. Then we are going to create some circular meters showing the usage with Roundline meters. We are going to monitor the CPU with a Line meter, and display some information about the space on your hard drives. You only see one hard drive in that image? We will get to that...私たちがやろうとしているのは、CPUの使用率と、2台のハードドライブの空き容量です。それから私達はRoundlineメーターで用法を示すいくつかの円形メーターを作成するつもりです。ラインメーターでCPUを監視し、ハードドライブの空き容量に関する情報を表示します。あなたはそのイメージの中に1つのハードドライブしか見えませんか?私たちはそれに到達するでしょう...

Building the System skinシステムスキンの構築

First, as we did in our earlier tutorial, let's add the [Rainmeter] section to control the Update speed of the skin.まず、以前のチュートリアルで行ったように、[Rainmeter]セクションを追加してスキンの更新速度を制御しましょう。

[Rainmeter]
Update=1000

The next thing we are going to do is define some variables for the skin. Variables are used to create a value, which can be used repeatedly in the skin by enclosing the variable name in ## (example: #VarName#). In order to change the value in all places it is used, you only need to change it one time in the [Variables] section of the skin.次にやることは、スキン用にいくつかの変数を定義することです。変数を使用して値を作成します。これは、変数名を##で囲むことによってスキン内で繰り返し使用できます(例:#VarName#)。使用されているすべての場所で値を変更するには、スキンの[Variables]セクションで1回だけ変更する必要があります。

[Variables]
DarkBlue=27,63,107,255
MediumBlue=92,135,209,255
LightBlue=207,224,255,255
LightRed=250,148,135,255
AlmostBlack=40,40,40,255
CurrentDrive=C:
Drive1=C:
Drive2=D:

Now we will cheat a bit. In earlier tutorials, we waited until the end and put a solid background on the skin using an Image meter. Let's go ahead and add that now, so we can demonstrate the first use of one of those variables we created above.今、私たちは少しカンニングします。以前のチュートリアルでは、最後まで待って、イメージメーターを使ってスキンにベタ背景を付けました。それでは、先に進んでそれを追加しましょう。それで、上記で作成した変数のうちの1つの最初の使用法を示すことができます

[MeterBackground]
Meter=Image
X=0
Y=0
W=185
H=110
SolidColor=#AlmostBlack#

Note that we have used the variable #AlmostBlack# in the SolidColor option for this meter. The meter will then use the value we defined as AlmostBlack=40,40,40,255 in the [Variables] section earlier. Remember that if you define SolidColor on an image meter with no MeasureName option, it simply draws a square or rectangle based on the W and H (width and height) options.このメーターのSolidColorオプションで変数#AlmostBlack#を使用したことに注意してください。それからメーターは、前の[変数]セクションで定義した値を使用します。MeasureNameオプションを指定せずにイメージメーターにSolidColorを定義するWとH(幅と高さ)のオプションに基づいて正方形または長方形が描画されるだけです。AlmostBlack=40,40,40,255

So let's load our new skin and take a look at where we stand. From the Manage dialog, find the System.ini entry in the list and click on the Load button on the upper right.それでは、新しいスキンをロードして、立っている場所を見てみましょう。以下からの管理ダイアログ、見つけるのSystem.iniリスト内のエントリをしてをクリックしてロード右上のボタンを押します。

Not much to look at just yet...まだ見ているほどではありません...

Next, let's create a measure to get the current amount of CPU usage, as a percentage, on each update.次に、更新ごとに現在のCPU使用量をパーセンテージで取得する指標を作成しましょう。

[MeasureCPU]
Measure=CPU

Now it is time to introduce a new meter type. We are going to display the value of that [MeasureCPU] measure as filling a cirle on the screen using a Roundline meter. Create a new section with this code:今度は新しいメータータイプを導入する時が来ました。その[MeasureCPU]メジャーの値をRoundlineメーターを使用して画面上の円を塗りつぶすように表示します。このコードで新しいセクションを作成してください。

[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1

Refresh the skin so we can see what it is doing as we walk through the options.オプションを順に見ながら、スキンがリフレッシュしていることを確認します。

What the Roundline meter does is draw a line that rotates around the center of a circle defined by the W and H options of the meter. In this case, we have defined the size of the meter (and thus the circle) as 40x40 pixels. Keep in mind that this defines a circle that has a total width of 40 pixels, and a width from the center to the edge as 20 pixels.Roundlineのメーターがないことによって定義された円の中心の周りを回転するライン描画でWとHメートルの選択肢を。この場合、メーターのサイズ(つまり円)を40 x 40ピクセルとして定義しました。これは、合計幅40ピクセル、中心から端までの幅が20ピクセルの円を定義することに注意してください。

Roundline - Working with anglesラウンドライン - 角度の操作

We first needed to define two options to control how the meter works. We need to tell the Roundline where the line should point when the value is 0% (the starting point). This is done with the StartAngle option. We also need to tell the Roundline how much of the circle to use as 100% (the distance to travel when the value is 100%). This is done with the RotationAngle option. As you can see, we have set the value of StartAngle to StartAngle=(Rad(270)), and the value of RotationAngle to RotationAngle=(Rad(360)). Let's talk about that for a minute.最初に、メーターの動作を制御するために2つのオプションを定義する必要がありました。値が0%(開始点)のときに、線がどこを指すべきかをRoundlineに指示する必要があります。これはStartAngleオプションで行われます。また、100%として使用する円の(値が100%の場合の移動距離)をRoundlineに指示する必要があります。これはRotationAngleオプションで行われます。あなたが見ることができるように、我々はの値に設定しているstartAngleのStartAngle=(Rad(270))、との値回転角度にしますRotationAngle=(Rad(360))。ちょっとそれについて話しましょう。

The angles in a Roundline meter are defined in Radians. Radians are a unit of measure used to define degrees of distance around a circle, starting with , which is the point directly to the right of the center of the circle. This is important! Do not picture a compass in your head, which has (North) pointing "up". Radians are defined with pointing to the right.ラウンドラインメーターの角度ラジアンで定義されています。ラジアンは、円の中心のすぐ右側の点であるから始まる円の周囲の距離を定義するために使用される測定単位です。これは重要!あなたの頭の中で(北)が "上"を指しているコンパスを描いてはいけません。ラジアンは右を向くように定義されます

I highly recommend taking a minute and reading through the explanation at Radians Guide.少し時間をかけて、Radians Guideの説明を読むことを強くお勧めします。

So beginning with StartAngle, we are telling the Roundline that the starting point of the meter is a distance of 270° degrees in radians from the 0° position of directly right. That will move the starting point around clockwise to the "top" of the meter, which is what we want.だからStartAngleから始めて、メーターの始点は0°の位置から270°のラジアンの距離であることをRoundlineに伝えています。それは出発点を時計回りにメーターの "上"に動かすでしょう、それが私たちが欲しいものです。

Next, we are setting the RotationAngle option to 360° degrees in radians, which tells the Roundline that the distance to travel around the circle from the starting point defined in StartAngle will be the full circle (a circle has 360 degrees). We want the entire circle to fill when the value of the measure is 100%.次に、RotationAngleオプションをラジアンで360°に設定します。これは、StartAngleで定義された開始点から円周上を移動する距離が完全な円になるようにRoundlineに指示します(円は360°です)。メジャーの値が100%のときに円全体を埋めます。

Note that we are using the Rad(x) function to make it easier to convert degrees (which are easy to picture in our heads) into radians (which are mathematically useful, but stupidly complicated).Rad(x)関数を使って(頭の中で描くのが簡単)をラジアン(数学的には有用ですが愚かに複雑です)に変換しやすくすることに注意してください。

Roundline - The line optionsラウンドライン - ラインオプション

By default, the Roundline meter will draw a single line from the center of the meter to the outside edge, pointing to the position represented by the value of the measure. We don't want a "pointer" in this case, but want to draw and fill a circle. There are few options we have used to control this.デフォルトでは、Roundlineメーターはメーターの中心から外側の端まで1本の線を引き、メジャーの値で表される位置を指します。この場合、「ポインタ」は必要ありませんが、円を描いて塗りつぶしたいのです。これを制御するために使用したオプションはほとんどありません。

  • LineStart=15
    This tells the Roundline that we want the line to start 15 pixels from the center of the meter.LineStart = 15
    これは、ラインがメーターの中心から15ピクセルの位置から始まっていることをRoundlineに伝えます。
  • LineLength=20
    This sets the overall length of the line to 20 pixels. Remember that our meter is 40 pixels wide in total, but only 20 pixels wide from the center to the outside edge.

    The result of these two options is a line that starts 15 pixels from the center, and extends to the full 20 pixels defined as the length from the center to the edge. So in effect, a 5 pixel line at the outside edge.LineLength = 20
    これは線の全長を20ピクセルに設定します。私たちのメーターの幅は合計40ピクセルですが、中心から外側の端までの幅はわずか20ピクセルです。

    これら2つのオプションの結果は、中心から15ピクセルから始まり、中心から端までの長さとして定義された全20ピクセルまで伸びる線です。つまり、実際には、外側の端に5ピクセルの行があります。


  • Solid=1
    This option tells the Roundline that instead of a single line, we want the meter to "fill" from the position defined as 0% to the current value represented by the measure. So instead of a "pointer", we get a circle being filled as the value changes.Solid = 1
    このオプションは、1行ではなく、0%として定義された位置から数値データで表される現在の値までメーターを「塗りつぶし」たいことをRoundlineに伝えます。そのため、「ポインタ」の代わりに、値が変化するにつれて円が塗りつぶされます。

Then we are using one of the variables we defined in the [Variables] section at the beginning. We want to set the color of the circle to a nice light blue, which we defined as LightBlue=207,224,255,255. So we set the option in the Roundline meter to LineColor=#LightBlue#.

Good job! Roundline is a very useful and flexible meter type in Rainmeter, and once you play with the options and different behaviors you will find lots of creative ways to use it. Take a breather...それでは、冒頭の[変数]セクションで定義した変数の1つを使用しています。円の色を素敵な水色に設定したいと思いLightBlue=207,224,255,255ます。そこで、Roundlineメーターのオプションをに設定しますLineColor=#LightBlue#

よくやった!ラウンドラインはレインメーターの中で非常に便利で柔軟なメータータイプです、そしてあなたがオプションと異なった振舞いで遊ぶと、あなたはそれを使うための創造的な方法の多くを見つけるでしょう。息を吸う...

Continuing the skinスキンを続ける

That Roundline meter looks a little funny by itself, so let's add another Roundline meter to serve as a "background" for it. In your code, move up above the [MeterCPUCircle] section we added before, and insert a new meter section. Remember, we want this meter to be "behind" [MeterCPUCircle], so it needs to be "before" it in the actual .ini skin code.そのラウンドラインメーターはそれ自体で少し面白そうに見えます、それでそれのための「背景」として役立つもう一つのラウンドラインメーターを加えましょう。あなたのコードで、前に追加した[MeterCPUCircle]セクションのに移動して、新しいメーターセクションを挿入します。覚えておいてください、私たちはこのメーターを「後ろ」[MeterCPUCircle]にしたいので、実際の.iniスキンコードでは "前"にする必要があります。

[MeterCPUCircleBack]
Meter=Roundline
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1

What we are doing here is creating another Roundline meter, at the same X and Y position as the one that comes after, but behind it. All of the options in [MeterCPUCircleBack] are the same as those in [MeterCPUCircle], with the exception that there is no MeasureName option to "bind" a measure to the meter. Roundline will by default use a value of 100% in this case, in effect allowing us to draw a full circle that we can use as a background. Oh, we also used a different variable for the color of the line. Refresh the skin to see the change.ここでやっていることは、後に来るもの同じXとY位置に、その後ろに別のRoundlineメーターを作成することです。すべてのオプション[MeterCPUCircleBack]は、と同様である[MeterCPUCircle]何も存在しないことを除いて、MeasureNameのオプションに「バインド」メーターに対策を。この場合、Roundlineはデフォルトで100%の値を使用します。これにより、背景として使用できる円??を描くことができます。ああ、私たちはまた線の色に別の変数を使った。変更を確認するためにスキンを更新してください。

Your entire skin code should now look like this:スキンコード全体が次のようになります。

[Rainmeter]
Update=1000

[Variables]
DarkBlue=27,63,107,255
MediumBlue=92,135,209,255
LightBlue=207,224,255,255
LightRed=250,148,135,255
AlmostBlack=40,40,40,255
CurrentDrive=C:
Drive1=C:
Drive2=D:

[MeasureCPU]
Measure=CPU

[MeterBackground]
Meter=Image
X=0
Y=0
W=185
H=110
SolidColor=#AlmostBlack#

[MeterCPUCircleBack]
Meter=Roundline
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1

[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1

Next we want to create a String meter showing the actual value we are getting in the [MeasureCPU] measure, and center it inside our circle. We have talked about string meters and positioning in earlier tutorials, so let's just add the following as a new section at the end of your skin code.次に、[MeasureCPU]メジャーで取得している実際の値を示す文字列メーターを作成し、それを円の中心に配置します。これまでのチュートリアルで文字列メーターと配置について説明しましたので、スキンコードの最後に新しいセクションとして以下を追加してみましょう。

[MeterCPUPercent]
Meter=String
MeasureName=MeasureCPU
FontFace=Segoe UI
FontSize=8
FontColor=#LightBlue#
X=26
Y=28
StringAlign=CenterCenter
StringStyle=Bold
AntiAlias=1
Text=%1%

Save and refresh the skin to see your new meter.スキンを保存してリフレッシュして、新しいメーターを確認します。

You know, it would be nice if the color of that text changed when the CPU usage hits some value we define. What we can do is change the color to "red" if the value is at or above 25%, and back to "blue" if it is below that value.ご存じのとおり、CPU使用率が定義した値に達するとそのテキストの色が変わってもいいでしょう。できることは、値が25%以上の場合は色を「赤」に変更し、それ以下の場合は「青」に戻すことです。

Go back near the top of the code and find the the [MeasureCPU] measure. Let's add a few lines to it.コードの先頭近くに戻り、[MeasureCPU]メジャーを見つけます。それに数行を追加しましょう。

[MeasureCPU]
Measure=CPU
IfAboveValue=24
IfAboveAction=[!SetOption MeterCPUPercent FontColor #LightRed#][!UpdateMeter *][!Redraw]
IfBelowValue=25
IfBelowAction=[!SetOption MeterCPUPercent FontColor #LightBlue#][!UpdateMeter *][!Redraw]

This is using IfAction options to do the following:これは、IfActionオプションを使用して次のことを行います。

  • If the value of the measure moves above 24, use the !SetOption bang to change the FontColor option on the [MeterCPUPercent] meter to the value of the variable #LightRed# we defined earlier in [Variables].メジャーの値が24を超える場合は、!SetOption bangを使用して[MeterCPUPercent]メーターのFontColorオプションを[変数]で先に定義した変数#LightRed#の値に変更します。
  • If the value of the measure falls below 25, use the !SetOption bang to change the FontColor option on the meter to the value of the variable #LightBlue# we defined earlier in [Variables], in effect changing it back to the original color.メジャーの値が25を下回る場合は、メーターのFontColorオプションを[変数]で前に定義した変数#LightBlue#の値に変更するために!SetOption bangを使用して、元の色に戻します。

Line meterラインメーター

Next we are going to touch on another meter type in Rainmeter. The Line meter displays the percentage value of a measure (or more than one measure) as a series of points over time, connected to create lines on a graph.次に、Rainmeterの別のメータータイプに触れます。ライン計は、グラフ上の線を作成するために接続された経時的な一連の点、等の測定値(または複数の測定)のパーセント値を表示します。

Add a new section to the skin.スキンに新しいセクションを追加してください。

[MeterCPULine]
Meter=Line
MeasureName=MeasureCPU
X=49
Y=8
W=130
H=38
LineCount=1
LineColor=#LightBlue#
LineWidth=1
HorizontalLines=1
HorizontalLineColor=#AlmostBlack#
SolidColor=#DarkBlue#

The Line meter is pretty self-explanatory, you "bind" one or more measures to the meter with MeasureName, and then use options like LineWidth and LineColor to control how the meter looks. The line is plotted over time on a graph that is defined by the W and H options of the meter. The additional HorizontalLines and HorizontalLineColor options draw the background lines on the graph, in the desired color. Finally, we set a SolidColor option on the meter to define a overall background color. Refresh the skin and have a look. Let it run for a while so you can see the movement of the line.ラインメーターを持つメートルまで一目瞭然、あなた「バインド」は、一つ以上の措置であるMeasureName、その後のようなオプション使用のLineWidthLineColorをメーターがどのように見えるかを制御します。この線は、メーターのWとHのオプションで定義されたグラフに時間の経過とともにプロットされます。追加のHorizo??ntalLinesおよびHorizo??ntalLineColorオプションは、グラフ上に背景線を希望の色で描画します。最後に、メーターにSolidColorオプションを設定して、全体的な背景色を定義します。スキンをリフレッシュして見てください。あなたはラインの動きを見ることができるようにしばらく走らせてください。

We should put a label on the Line meter, so it is clear what it is measuring. We have looked at the String meter previously, so let's just add one and take a look at the result.ラインメーターにラベルを貼る必要がありますので、何を測定しているのかは明らかです。私たちは見てきた文字列以前メートルなので、ちょうど1を追加し、結果を見てみましょう。

[MeterCPUText]
Meter=String
FontFace=Segoe UI
FontSize=15
FontColor=#LightBlue#
X=48
Y=4
StringStyle=Bold
AntiAlias=1
Text=CPU

Measuring a hard driveハードドライブを測定する

It is time to introduce a new measure type to our skin. We are going to be measuring the total, used, and free space on one of your hard drives. We will display the used space on a circular Roundline meter almost exactly as we did with the CPU measurement, then display the other information, total and free space, in string meters next to it.スキンに新しいメジャータイプを導入する時が来ました。私達はあなたのハードドライブの一つの合計使用、そして空き容量を測定するつもりです。我々が表示されます使用され、我々はCPUの測定で行ったように、他の情報表示、その後、ほぼ正確に円形Roundlineメートルのスペースを合計し、自由にその隣の文字列メートルで、スペースを。

First, let's set up the measures you will need. Back up in your skin code, right under the [MeasureCPU] we created in the beginning, and add some new measures.まず、必要な対策を設定しましょう。最初に作成した[MeasureCPU]のすぐ下に、スキンコードをバックアップし、新しいメジャーを追加します。

[MeasureDriveTotal]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
Total=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=-1

[MeasureDriveFree]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

[MeasureDriveUsed]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
InvertMeasure=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

The FreeDiskSpace measure obtains space information about a drive. There are several options we are using that should be explained.FreeDiskSpaceの尺度は、ドライブに関する空間情報を取得します。説明しなければならないオプションがいくつかあります。

  • Drive=#CurrentDrive#
    This option tells the measure which drive to examine. In this case, we are using one of the variables we defined earlier, to set the value to C:.Drive =#CurrentDrive#
    このオプションは、どのドライブを調べるかをメジャーに指示します。この場合、値をCに設定するために、前に定義した変数の1つを使用しています。
  • IgnoreRemovable=0
    By default, FreeDiskSpace will ignore all removable drives like USB or optical drives. Set IgnoreRemovable=0 to enable measuring these kinds of drives.IgnoreRemovable = 0
    デフォルトでは、FreeDiskSpaceはUSBや光学式ドライブなどのすべてのリムーバブルドライブを無視します。これらの種類のドライブの測定を有効にするには、IgnoreRemovable = 0を設定します。
  • InvertMeasure=1
    By default, FreeDiskSpace will measure the free space on a drive. To measure the used space, you use the General Measure Option InvertMeasure=1 to reverse what is measured.InvertMeasure = 1
    デフォルトでは、FreeDiskSpaceはドライブの空き容量を測定します。使用済みスペースを測定するには、一般測定オプション InvertMeasure = 1を使用して、測定されたものを元に戻します。

In addition, we are using two other options on the measures we have not looked at before.さらに、これまで見たことのない対策について、他に2つの選択肢を使用しています。

DynamicVariables is used to tell a measure or meter that any variables used in the section should be re-evaluated on each update of the section. In order to have Rainmeter use as few resources as possible, variables are only evaluated when the measure or meter is created, and will not detect any dynamic changes to variables it uses, if this option is not set. It will become clear in a little bit why we want this option on our FreeDiskSpace measures.DynamicVariablesは、そのセクションで使用されているすべての変数がそのセクションの更新ごとに再評価されるべきであることをメジャーまたはメーターに指示するために使用されます。可能な限り少ないリソースでRainmeterを使用するために、変数はメジャーまたはメーターが作成されたときにのみ評価され、このオプションが設定されていないと、使用する変数に対する動的な変更は検出されません。FreeDiskSpaceの測定値にこのオプションが必要な理由は少し明らかになります。

UpdateDivider is used to control how often a measure or meter is updated. The overall Update of the skin is set in the [Rainmeter] section at the top of the skin, and defines how often in milliseconds the skin is updated. In our case, and by default, this is Update=1000 or once a second.UpdateDividerは、メジャーまたはメーターを更新する頻度を制御するために使用されます。スキンの全体的な更新は、スキンの上部にある[Rainmeter]セクションで設定され、スキンが更新される頻度をミリ秒単位で定義します。私たちの場合、そしてデフォルトでは、これはUpdate=10001秒に1回です。

The UpdateDivider=5 option we are setting on these FreeDiskSpace measures tells Rainmeter to update these measures every 5 updates of the skin, or in our case every 5 seconds. UpdateDivider should be considered for any measures that don't need to be updated as often as the Update option alone, to reduce the amount of work that Rainmeter has to do. In the case of FreeDiskSpace, this is particularly useful as actually reading the drives once every second would be more resource hungry than is really needed.UpdateDivider=5我々はこれらのFreeDiskSpace措置に設定されているオプションは、これらの施策ごとに5つのスキンのアップデート、または当社の場合には5秒ごとに更新するようにRainmeterを伝えます。UpdateDividerは、Rainmeterがしなければならない作業の量を減らすために、Updateオプションだけで更新される必要がないすべての対策に対して考慮されるべきです。FreeDiskSpaceの場合、これは、実際に必要とされるよりも1秒に1回ドライブを実際に読み取ることがより多くのリソースを消費するため、特に便利です。

See the guide at Update Guide for a lot more detail and explanation.更なる詳細と説明についてはアップデートガイドのガイドを参照してください。

Ok, our measures are all set up, and providing the various kinds of space measurements for our drive in bytes. One thing that should be noted is that the FreeDiskSpace measure also automatically sets the MinValue and MaxValue of the measure, so the value can be used in meters that require a Percentage, like the Roundline meter we are about to create.わかりました、私達の測定はすべてセットアップされ、バイトの私達のドライブのためのいろいろな種類のスペース測定を提供します。一つ注意しなければならないのは、FreeDiskSpace対策も自動的に設定されることであるMinValueプロパティMaxValueを計量し、その値が必要メートルで使用することができる割合を、同じようRoundlineのメーター我々は作成しようとしています。

Add the following new meters to the skin.次のメーターをスキンに追加します。

[MeterDriveCircleBack]
Meter=Roundline
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1

[MeterDriveCircle]
Meter=Roundline
MeasureName=MeasureDriveUsed
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1

[MeterDriveCircleLabel]
Meter=String
FontFace=Segoe UI
FontSize=10
FontColor=#LightBlue#
X=26
Y=83
StringAlign=CenterCenter
StringStyle=Bold
Percentual=1
AntiAlias=1
DynamicVariables=1
Text=#CurrentDrive#

Note that these are pretty much identical to the meters we created earlier to show the CPU usage as a circular Roundline meter. We bind the active Roundline meter [MeterDriveCircle] to the measure [MeasureDriveUsed] to display the amount of "used" space, and instead of showing any measured value inside the circle in [MeterDriveCircleLabel], we simply create a label with the value of the current drive letter we created in the variable #CurrentDrive#. We again set DynamicVariables=1 on this label meter. We will see why shortly. Save and refresh the skin to see how we are doing.これらは、円形のRoundlineメーターとしてCPU使用率を示すために以前作成したメーターとほとんど同じです。アクティブなRoundlineメーター[MeterDriveCircle]をメジャー[MeasureDriveUsed]にバインドして、「使用済み」スペースの量を表示し、[MeterDriveCircleLabel]の円の内側に測定値を表示する代わりに、次の値のラベルを作成します。変数#CurrentDrive#に作成した現在のドライブ文字。我々は再びDynamicVariables=1このラベルメーターを設定した。その理由はすぐにわかります。スキンを保存してリフレッシュして、どうやっているかを確認します。

Finally, we can create a nice background to match the one behind the Line meter we created in [MeterCPULine], by simply creating an Image meter with a SolidColor and no MeasureName option, then some String meters to display the other drive space information, total and free. Add the following meters to the bottom of the skin. Save and refresh.最後に、我々は我々が作成したラインメーターの後ろに1と一致するように素敵な背景を作成することができます[MeterCPULine]を簡単に作成することにより、画像付きメートルsolidcolorがなしMeasureNameのオプションを、その後、いくつかの文字列メーターは、他のドライブの空き容量の情報を表示するには、合計そして無料です。以下のメーターをスキンの底に追加します。保存して更新します。

[MeterDriveBack]
Meter=Image
X=49
Y=63
W=130
H=38
SolidColor=#DarkBlue#

[MeterDriveTotalLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=64
StringStyle=Bold
StringAlign=Left
AutoScale=1
AntiAlias=1
Text=Total:

[MeterDriveTotal]
Meter=String
MeasureName=MeasureDriveTotal
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=64
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B

[MeterDriveFreeLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=81
W=130
H=18
ClipString=1
StringStyle=Bold
AutoScale=1
AntiAlias=1
Text=Free:

[MeterDriveFree]
Meter=String
MeasureName=MeasureDriveFree
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=81
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B

One new option we have used in two of these meters should be explained. The FreeDiskSpace measure obtains the space values from the drive in bytes. For most of us, that is going to be a really huge and long number, (my one-terabyte C: drive has a total of 1000097181696 bytes for instance) and probably not one we want to display on a skin. The AutoScale option on the string meter will automatically scale the number to megabytes, gigabytes, terabytes etc. and append the appropriate M / G / T label to the end. We have added an extra hard-coded B at the end of the text, so it will display as for instance: 931 GB. Let's take a look.これら2つのメーターで使用した1つの新しいオプションについて説明します。FreeDiskSpaceの尺度は、ドライブから空間値を取得バイト。私たちのほとんどにとって、それは本当に巨大で長い数字になるでしょう(私の1テラバイトのC:ドライブは例えば1000097181696バイトの合計を持っています)、そしておそらく私たちがスキンに表示したいものではないでしょう。オートスケールの文字列メーターのオプションが自動的に番号をスケールしますメガバイトギガバイトテラバイトなど、適切な追加M / G / Tの終わりにラベルを。テキストの末尾にハードコードされた追加のBを追加したので、たとえば次のように表示されます。931 GB。見てみましょう。

What about those dynamic variables?それらの動的変数はどうですか?

I promised we would get back to the reason why we added DynamicVariables=1 to a few measures and meters. Our last goal is to have the skin dynamically change the Drive that we measure and display when we move the mouse over the skin.DynamicVariables = 1をいくつかのメジャーとメーターに追加した理由に戻ることを約束しました。最後の目標は、マウスをスキンの上に移動したときに、測定して表示するドライブをスキンに動的に変更させることです。

If you look back to the [Variables] section, you will see that we set the following:[変数]セクションを振り返ると、次のように設定されていることがわかります。

CurrentDrive=C:
Drive1=C:
Drive2=D:

Then in our FreeDiskSpace measures [MeasureDriveTotal], [MeasureDriveFree], and [MeasureDriveUsed], we set the Drive option to that variable #CurrentDrive#. So to start with, the measures are looking at the C: drive. What we want to do is set the value of #CurrentDrive# to be equal to the value of the variable #Drive2# when we move the mouse over the skin, and back to #Drive1# when we move the mouse away.次に、FreeDiskSpaceのメジャー[MeasureDriveTotal][MeasureDriveFree]、および[MeasureDriveUsed]で、Driveオプションをその変数#CurrentDrive#に設定します。それで最初に、対策はC:ドライブを見ています。私たちがしたいのは、#CurrentDrive#の値を、マウスをスキンの上に移動したときに変数#Drive2#の値と等しくなるように設定し、マウスを離したときに#Drive1#に戻ることです。

To accomplish this, we need to add new Mouse actions to the skin, and some Bangs that are executed by the mouse actions.これを実現するには、新しいMouseアクションをスキンに追加する必要があります。また、マウスアクションによって実行されるBangをいくつか追加する必要があります。

Let's go back up to our [MeterBackground] meter, the first one after the measures in the skin. Change it by adding our mouse action lines.[MeterBackground]メーターに戻ってみましょう。これは、スキンの測定後の最初のメーターです。マウスアクションラインを追加して変更してください。

[MeterBackground]
Meter=Image
X=0
Y=0
W=185
H=110
SolidColor=#AlmostBlack#
MouseOverAction=[!SetVariable CurrentDrive #Drive2#][!UpdateMeasure *][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetVariable CurrentDrive #Drive1#][!UpdateMeasure *][!UpdateMeter *][!Redraw]

What this is saying is:これが言っているのは、

  • If the mouse moves over the background meter, use the !SetVariable bang to change the value of the variable CurrentDrive to the value of the variable Drive2.背景メーターの上にマウスを移動する場合は、使用!はSetVariable変数の値を変更するために強打を電流駆動を変数の値にドライブ2
  • If the mouse moves away from the background meter, use the !SetVariable bang to change the value of the variable CurrentDrive to the value of the variable Drive1, or in effect back to the original value.マウスがバックグラウンドメーターから離れた場合は、!SetVariable bangを使用して、変数CurrentDriveの値を変数Drive1の値に変更するか、事実上元の値に戻します。
  • Then we are using the !UpdateMeasure, !UpdateMeter, and !Redraw bangs to have the change take place as soon as we move the mouse over or away, and not wait for the next update of the skin.それから、!UpdateMeasure!UpdateMeter、および!Redrawを使用して、マウスを移動するとすぐに変更が行われ、次のスキンの更新を待ちません。

This functionality is why we added DynamicVariables=1 to the measures and meters which are using the #CurrentDrive# variable. That option allows the measures and meters to re-evaluate the variable on each update of the section, so when we change it with !SetVariable they react to the change.この機能が、#CurrentDrive#変数を使用している小節とメーターにDynamicVariables = 1を追加した理由です。そのオプションは、小節とメーターがセクションの更新ごとに変数を再評価することを可能にします、それで我々がそれを変更するとき!SetVariableそれらは変更に反応します。

So we are finally there... Great job! Here are two shots of your final skin, the first with the mouse away from the skin and the second with the mouse over the skin.それで我々はついにそこにいます...素晴らしい仕事!ここにあなたの最終的なスキンの2つのショットがあります、最初はスキンから離れているマウスで、そして2番目はスキンの上にマウスであります。

Mouse Offマウスオフ

Mouse Overマウスオーバー

And here is the final code so you can compare to yours.そして、これが最終的なコードなので、自分のものと比較できます。

[Rainmeter]
Update=1000

[Variables]
DarkBlue=27,63,107,255
MediumBlue=92,135,209,255
LightBlue=207,224,255,255
LightRed=250,148,135,255
AlmostBlack=40,40,40,255
CurrentDrive=C:
Drive1=C:
Drive2=D:

[MeasureCPU]
Measure=CPU
IfAboveValue=24
IfAboveAction=[!SetOption MeterCPUPercent FontColor #LightRed#][!UpdateMeter *][!Redraw]
IfBelowValue=25
IfBelowAction=[!SetOption MeterCPUPercent FontColor #LightBlue#][!UpdateMeter *][!Redraw]

[MeasureDriveTotal]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
Total=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=-1

[MeasureDriveFree]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

[MeasureDriveUsed]
Measure=FreeDiskSpace
Drive=#CurrentDrive#
InvertMeasure=1
IgnoreRemovable=0
DynamicVariables=1
UpdateDivider=5

[MeterBackground]
Meter=Image
X=0
Y=0
W=185
H=110
SolidColor=#AlmostBlack#
MouseOverAction=[!SetVariable CurrentDrive #Drive2#][!UpdateMeasure *][!UpdateMeter *][!Redraw]
MouseLeaveAction=[!SetVariable CurrentDrive #Drive1#][!UpdateMeasure *][!UpdateMeter *][!Redraw]

[MeterCPUCircleBack]
Meter=Roundline
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1

[MeterCPUCircle]
Meter=Roundline
MeasureName=MeasureCPU
X=5
Y=8
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1

[MeterCPUPercent]
Meter=String
MeasureName=MeasureCPU
FontFace=Segoe UI
FontSize=8
FontColor=#LightBlue#
X=26
Y=28
StringAlign=CenterCenter
StringStyle=Bold
AntiAlias=1
Text=%1%

[MeterCPULine]
Meter=Line
MeasureName=MeasureCPU
X=49
Y=8
W=130
H=38
LineCount=1
LineColor=#LightBlue#
LineWidth=1
HorizontalLines=1
HorizontalLineColor=#AlmostBlack#
SolidColor=#DarkBlue#

[MeterCPUText]
Meter=String
FontFace=Segoe UI
FontSize=15
FontColor=#LightBlue#
X=48
Y=4
StringStyle=Bold
AntiAlias=1
Text=CPU

[MeterDriveCircleBack]
Meter=Roundline
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#MediumBlue#
AntiAlias=1

[MeterDriveCircle]
Meter=Roundline
MeasureName=MeasureDriveUsed
X=5
Y=63
W=40
H=40
StartAngle=(Rad(270))
RotationAngle=(Rad(360))
LineStart=15
LineLength=20
Solid=1
LineColor=#LightBlue#
AntiAlias=1

[MeterDriveCircleLabel]
Meter=String
FontFace=Segoe UI
FontSize=10
FontColor=#LightBlue#
X=26
Y=83
StringAlign=CenterCenter
StringStyle=Bold
Percentual=1
AntiAlias=1
DynamicVariables=1
Text=#CurrentDrive#

[MeterDriveBack]
Meter=Image
X=49
Y=63
W=130
H=38
SolidColor=#DarkBlue#

[MeterDriveTotalLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=64
StringStyle=Bold
StringAlign=Left
AutoScale=1
AntiAlias=1
Text=Total:

[MeterDriveTotal]
Meter=String
MeasureName=MeasureDriveTotal
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=64
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B

[MeterDriveFreeLabel]
Meter=String
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=50
Y=81
W=130
H=18
ClipString=1
StringStyle=Bold
AutoScale=1
AntiAlias=1
Text=Free:

[MeterDriveFree]
Meter=String
MeasureName=MeasureDriveFree
FontFace=Segoe UI
FontSize=11
FontColor=#LightBlue#
X=180
Y=81
StringStyle=Bold
StringAlign=Right
AutoScale=1
AntiAlias=1
Text=%1B

« Back to: Clock

関連記事

スポンサーリンク

内容物を持たないセル要素の枠線が隣接する枠線と重なる

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

上に戻る