任何类型的用户输入都可以。这是我到目前为止的代码。
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim Account
Account = 111111
WScript.Sleep 5000
Do
WScript.Sleep 400
WshShell.SendKeys "drill "
WshShell.SendKeys Account
WshShell.SendKeys "{ENTER}"
Account = Account + 1
Loop
基本上它是代码猜测器(用于游戏),我希望能够用任何类型的用户输入来中断它。
答案 0 :(得分:0)
我认为我们没有任何直接的解决方案。下面的代码在50次迭代后寻求用户交互。如果是,则控制退出do循环。您可以使用其他方式来中断循环,当然您可以根据需要更改计数器。
Set WshShell = WScript.CreateObject("WScript.Shell")
Dim counter
Dim Account
Dim msgResult
counter = 0
Account = 111111
WScript.Sleep 5000
Do
WScript.Sleep 400
WshShell.SendKeys "drill "
WshShell.SendKeys "drill "
WshShell.SendKeys Account
WshShell.SendKeys "{ENTER}"
Account = Account + 1
If counter = 50 Then 'get user input after 50 iterations
msgResult = MsgBox("Do you want to exit?", vbYesNo)
If msgResult = vbYes Then 'if yes
Exit Do
End If
End If
counter = counter + 1
If counter > 101 then
counter =0
End If
Loop