Mouse Variables マウス変数

Mouse variables are a special function to return the X and Y position of the mouse cursor when a mouse action takes place.マウス変数は、マウス操作が行われたときにマウスカーソルのXおよびY位置を返すための特別な関数です。

The position is relative to the meter that has the mouse click or scroll action, or the skin if used in the [Rainmeter] section.この位置は、マウスのクリックまたはスクロール操作があるメーター、または[Rainmeter]セクションで使用されている場合はスキンに対する相対位置です。

There are two variants of the function.関数には2つの種類があります。

  • $MouseX$ and $MouseY$
    Contains the current X and Y position of the mouse in pixels relative to the meter or skin.$ MouseX $$ MouseY $
    マウスの現在のXとYの位置を、メーターまたはスキンを基準にしたピクセル数で格納します。
  • $MouseX:%$ and $MouseY:%$
    Contains the current X and Y position of the mouse as a percentage relative to the meter or skin.$ MouseX :%$および$ MouseY:%$
    マウスの現在のXおよびY位置を、メーターまたはスキンに対する相対的な割合として格納します。

Usage使用法

The variables are only created and used in the context of a mouse click or scroll action. Primarily, they will be used as a parameter to a Bang. For instance:変数は、マウスクリックまたはスクロール操作のコンテキストでのみ作成および使用されます。主に、それらはBangに対するパラメータとして使用されます。例えば:

LeftMouseUpAction=[!SetOption SomeMeter X $MouseX$][!UpdateMeter *][!Redraw]

LeftMouseUpAction=!CommandMeasure ScriptMeasure GetRGB($MouseX$,$MouseY$)

Notes: The values returned are not the mouse position on the screen, but are pixels or a percentage relative to the meter or skin with the mouse action. They are also not general purpose variables, and when used outside the context of a mouse action on a meter or the skin, will not contain a value.メモ:返される値は画面上のマウスの位置ではなく、マウスの操作によるメーターまたはスキンに対するピクセルまたはパーセンテージです。これらは汎用変数でもありません。また、メーターまたはスキン上でのマウス操作のコンテキスト外で使用された場合、値は含まれません。

$MouseX$

X position of the mouse cursor as a number of pixels relative to the meter or skin with the mouse action.マウスアクションのあるメーターまたはスキンに対するピクセル数で表したマウスカーソルのX位置。

$MouseY$

Y position of the mouse cursor as a number of pixels relative to the meter or skin with the mouse action.マウスアクションのあるメーターまたはスキンに対するピクセル数で表したマウスカーソルのY位置。

$MouseX:%$

X position of the mouse cursor as a percentage relative to the meter or skin with the mouse action.マウスアクションのあるメーターまたはスキンに対するパーセントとしてのマウスカーソルのX位置。

$MouseY:%$

Y position of the mouse cursor as a percentage relative to the meter or skin with the mouse action.マウスアクションのあるメーターまたはスキンに対するマウスカーソルのY位置(パーセント)。

Example

[Rainmeter]
LeftMouseUpAction=[!SetOptionGroup Coordinates Text "Click the square!"][!UpdateMeterGroup Coordinates][!Redraw]

[Background]
Meter=Image
SolidColor=0,0,150
W=150
H=225

[CoordinateA]
Meter=String
FontColor=255,255,255
Text=Click the square!
Group=Coordinates

[RedSquare]
Meter=Image
SolidColor=255,0,0
X=25
Y=30
W=100
H=100
LeftMouseUpAction=[!SetOption CoordinateA Text "($MouseX$, $MouseY$)"][!UpdateMeter CoordinateA][!Redraw]
MouseActionCursorName=Cross

[CoordinateB]
Meter=String
FontColor=255,255,255
Text=Click the square!
Group=Coordinates
Y=20R

[GreenSquare]
Meter=Image
SolidColor=0,255,0
X=25
Y=180
W=100
H=25
LeftMouseUpAction=[!SetOption CoordinateB Text "X = $MouseX:%$%, Y = $MouseY:%$%"][!UpdateMeter CoordinateB][!Redraw]
MouseActionCursorName=Cross

関連記事

スポンサーリンク

Softbankで絵文字を表示させる

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

上に戻る