Click

指定した座標でマウスボタンをクリックします。また、マウスボタンの長押し、マウスホイールの回転、マウスの移動も可能です。

Click Options

パラメータ

Options

Specify one or more of the following components: Coords, WhichButton, ClickCount, DownOrUp and/or Relative. If all components are omitted, a single left click is performed at the mouse cursor's current position.

The components may be spread across multiple parameters or combined into one or more strings. Each parameter may be either a single numeric component or a string containing zero or more components, where each component is separated from the next with at least one space, tab and/or comma (all within the string). For example, Click 100, 200, "R D" is equivalent to Click "100 200 R D" and both are valid. Parameters that are blank or omitted are ignored, as are extra commas.

Warning: Click 100 200 would be equivalent to Click "100200", as the two numbers would be concatenated before the function is called.

The components can appear in any order except ClickCount, which must occur somewhere to the right of Coords, if present.

Coords: If omitted, the cursor's current position is used. Otherwise, specify the X and Y coordinates to which the mouse cursor is moved prior to clicking. 例えば、Click "100 200"は、マウスの左ボタンを特定の位置でクリックすることができます。Coordinates are relative to the active window's client area unless CoordMode was used to change that.

WhichButton: If omitted, it defaults to Left (the left mouse button). Otherwise, specify Left, Right, Middle (or just the first letter of each of these); or X1 (fourth button) or X2 (fifth button). 例えば、クリック「右」すると、マウスカーソルの現在位置でマウスの右ボタンをクリックすることができます。左はプライマリーボタン、右はセカンダリーボタンに対応します。ユーザーがシステム設定でボタンを入れ替えると、ボタンの物理的な位置は入れ替わりますが、効果は変わりません。

WhichButtonには、ホイールを上方向(自分から離れる方向)に向けるWheelUpまたはWU、ホイールを下方向(自分から近づく方向)に向けるWheelDownまたはWDを指定することも可能です。WheelLeft(またはWL)またはWheelRight(またはWR)を指定することもできる。ClickCountは、ホイールを回すノッチの数です。ただし、アプリケーションによっては、マウスホイールのClickCountの値が1以上であることに従わないものもあります。それらのために、Loopなどの手段でClick機能を複数回使用します。

ClickCount: If omitted, it defaults to 1. Otherwise, specify the number of times to click the mouse button or turn the mouse wheel. 例えば、Click 2は、マウスカーソルの現在位置でダブルクリックを行います。Coordsが指定されている場合は、ClickCountはその後に表示されなければならない。クリックせずにマウスを動かす場合は、ゼロ(0)を指定します(例:クリック「100 200 0」)。

DownOrUp: If omitted, each click consists of a down-event followed by an up-event. それ以外の場合は、マウスボタンを離さずに押し下げるDown(または文字D)を指定します。その後、Up(またはUの文字)という単語を使ってマウスボタンを離します。例えば、Click "Down"は、マウスの左ボタンを押し下げ、そのまま保持します。

Relative: If omitted, the X and Y coordinates will be used for absolute positioning. Otherwise, specify the word Rel or Relative to treat the coordinates as offsets from the current mouse position. つまり、カーソルは現在位置から右にXピクセル(負の場合は左)、下にYピクセル(負の場合は上)だけ移動します。

備考

Click関数は、SendModeで設定された送信方式を使用します。特定のクリックに対してこのモードを上書きするには、この例のように{Click}と組み合わせて特定のSend関数を使用します。SendEvent "{Click 100 200}".

Shift-ClickやControl-Clickを行うには、一般的にSend経由のクリックが最も簡単です。事例:

Send "+{Click 100 200}"  ; Shift+LeftClick
Send "^{Click 100 200 Right}"  ; Control+RightClick

クリック機能は、送信とは異なり、修飾キー(Ctrl、Alt、Shift、Win)を自動的に解除することはありません。例えば、現在Ctrlが押されている場合、Clickはコントロールクリックになりますが、Send "{Click}"は通常のクリックになります。

SendPlayモードは、他のモードに比べ、より幅広いゲームにおいてマウスイベントを正常に発生させることができます。また、アプリケーションやゲームによっては、マウスの動きが速すぎると追従できない場合があります。その場合は、SetDefaultMouseSpeedを使用して速度を下げることができます(ただし、SendEventモード時のみ)。

BlockInput関数を使用すると、ユーザーによる物理的なマウス操作が、マウス関数によって生成されるシミュレーションマウスイベントを妨害することを防ぐことができます。ただし、SendInputSendPlayモードでは、ユーザーの物理的なマウス操作を自動的に後回しにするため、一般にこの操作は必要ありません。

マウスのクリックダウンとクリックアップのたびに、自動的に遅延が発生します(SendInputモードとマウスホイールを回す場合を除く)。ディレイの長さを変更する場合は、SetMouseDelayを使用します。

Send "{Click}", SendMode, CoordMode, SetDefaultMouseSpeed, SetMouseDelay, MouseClick, MouseClickDrag, MouseMove, ControlClick, BlockInput

マウスカーソルの現在位置でマウスの左ボタンをクリックします。

Click

マウスの左ボタンを特定の位置でクリックします。

Click 100, 200

クリックせずに、マウスカーソルを特定の位置に移動させます。

Click 100, 200, 0

マウスの右ボタンを特定の位置でクリックします。

Click 100, 200, "Right"

マウスカーソルの現在位置でダブルクリックを行います。

Click 2

マウスの左ボタンを押し下げ、そのまま保持します。

Click "Down"

マウスの右ボタンを離します。

Click "Up Right"