我正在运行这个[极其简单]的脚本:
#include<MsgBoxConstants.au3>
Send("{w down}")
Sleep(5000)
Send("{w up}")
我想做的是按住";w";按键5秒;这个脚本根本不起作用。
的不同解释
Opt('SendKeyDelay', 50); Default speed
_Send('w', 5000)
Func _Send($text, $milliseconds)
$time = TimerInit()
Do
Send($text)
Until TimerDiff($time) > $milliseconds
EndFunc
另一种方式不同的结果
#include <Misc.au3>
$timer=TimerInit()
Send("{w down}") ;Holds the w key down
While _IsPressed("57")
Beep(1000, 100) ; audiable proof
If TimerDiff($timer) > 5000 Then ExitLoop
WEnd
Send("{w up}") ;Releases the w key
和另一个
#include <Date.au3>
HotKeySet("1", "_hold_w") ; 1
While 1
Sleep(250)
WEnd
Func _hold_w()
ConsoleWrite(_NowTime(5) & @CRLF)
Opt('SendKeyDownDelay', 5000)
Send('w')
ConsoleWrite(_NowTime(5) & @CRLF)
EndFunc ;==>_hold_w