SetKeyDelay

SendまたはControlSendでキーストロークを送信するたびに発生する遅延時間を設定します。

SetKeyDelay Delay, PressDuration, "Play"

パラメータ

Delay

型:整数

If omitted, the current delay is retained. Otherwise, specify the time in milliseconds. Specify -1 for no delay at all or 0 for the smallest possible delay (however, if the Play parameter is present, both 0 and -1 produce no delay).

PressDuration

型:整数

ゲームなどの特殊なアプリケーションでは、キーを押した後、離すまでの間に遅延が必要な場合があります。

If omitted, the current press duration is retained. Otherwise, specify the time in milliseconds. Specify -1 for no delay at all or 0 for the smallest possible delay (however, if the Play parameter is present, both 0 and -1 produce no delay).

Note: PressDuration also produces a delay after any change to the modifier key state (Ctrl, Alt, Shift, and Win) needed to support the keys being sent.

Play

型:文字列

If blank or omitted, the delay and press duration are applied to the traditional SendEvent mode. Otherwise, specify the word Play to apply both to the SendPlay mode. If a script never uses this parameter, both are always -1 for SendPlay.

備考

If SetKeyDelay is not used, the default delay is 10 for the traditional SendEvent mode and -1 for SendPlay mode. The default press duration is -1 for both modes.

SetKeyDelay is not obeyed by SendInput; there is no delay between keystrokes in that mode. This same is true for Send when SendMode Input is in effect.

SendまたはControlSendでキーストロークを送信するたびに、短い遅延(スリープ)が自動的に行われます。これはスクリプトの信頼性を高めるためで、キー入力が殺到するとウィンドウが追いつかなくなることがあるためです。

遅延(スリープ)中は、現在のスレッドを中断できないようにする。

OSの時間管理システムの粒度の関係で、遅延は10や15の倍数に切り上げられる場合があります。

Send/SendEventモードでは、遅延が0の場合、内部的にSleep(0)が実行され、スクリプトのタイムスライスの残りを必要とする他のプロセスに提供します。ない場合は、Sleep(0)は全くスリープしない。これに対して、遅延が-1の場合は、決して眠ることはありません。信頼性を高めるために、-1の代わりに0を推奨します。

遅延を-1に設定すると、従来のSendEventモードを使用する場合、スクリプトのプロセス優先度がキーストロークの送信速度に重要な要素となる。スクリプトの優先度を上げるには、ProcessSetPriority "High"を使用します。この場合、通常、アクティブウィンドウが処理できる速度よりも速くキーストロークが送信されることになりますが、システムは自動的にバッファリングします。バッファリングされたキー入力は、Send関数が完了した後も(ウィンドウがアクティブでなくなっても)ターゲットウィンドウに到着し続けます。これは、同じウィンドウに送信される後続のキー入力が、すでにバッファにあるキー入力の後ろにキューイングされるため、通常、無害です。

組込変数A_KeyDelayには、Send/SendEvent モードのDelayの現在の設定値が格納される。A_KeyDuration contains the setting for PressDuration, while A_KeyDelayPlay and A_KeyDurationPlay contain the settings for SendPlay.

新しく起動するスレッドホットキーカスタムメニュー項目時間指定サブルーチンなど)はすべて、この機能のデフォルト設定で新しくスタートします。このデフォルトは、スクリプト起動時にこの関数を使用することで変更することができます。

Send, ControlSend, SendMode, SetMouseDelay, SetControlDelay, SetWinDelay, Click

SendまたはControlSendで送信される各キーストロークの後に、可能な限り小さな遅延が発生するようにします。

SetKeyDelay 0