在 运行 时关闭 VBScript 程序
Turn off a VBScript program while it is running
(这是一个 .vbs 程序) 我正在尝试为程序制作一个消息机器人,但我遇到了一个问题,如果你将时间设置得太长, 并将消息数量设置得太高,您无法轻易停止程序,并且必须处理一遍又一遍地键入的消息,直到它完成。有没有办法在 运行 停止输入消息时添加选项?
这是代码:
set shell = createobject ("wscript.shell")
strtext = inputbox ("Type the message you like to type")
strtimes = inputbox ("How many times would you like to type this message?")
strspeed = inputbox ("How fast do you like to message? (1000 = one per sec, 100 = 10 per sec etc)")
strtimeneed = inputbox ("How many SECONDS do you need to get to your input box?")
If not isnumeric (strtimes & strspeed & strtimeneed) then
msgbox "You entered something else then a number on Times, Speed and/or Time need. Closing program"
wscript.quit
End If
strtimeneed2 = strtimeneed * 1000
do
msgbox "You have " & strtimeneed & " seconds to get to your input area where you are going to message."
wscript.sleep strtimeneed2
shell.sendkeys ("Hello" & "{enter}")
for i=0 to strtimes
shell.sendkeys (strtext & "{enter}")
wscript.sleep strspeed
Next
shell.sendkeys ("Bye" & "{enter}")
wscript.sleep strspeed * strtimes / 10
returnvalue=MsgBox ("Want to send the messages again with the same info?",36)
If returnvalue=6 Then
Msgbox "Ok Messagebot will activate again"
End If
If returnvalue=7 Then
msgbox "Messaging is shutting down"
wscript.quit
End IF
loop
您可以设置一个快捷方式来终止所有 运行 wscript.exe
进程。在桌面上单击鼠标右键,在上下文菜单中选择新建 - 快捷方式:
输入 %comspec% /c taskkill /f /im wscript.exe
作为位置并单击 下一步:
输入一个你喜欢的名字然后点击完成:
您也可以在快捷方式属性中指定热键。
(这是一个 .vbs 程序) 我正在尝试为程序制作一个消息机器人,但我遇到了一个问题,如果你将时间设置得太长, 并将消息数量设置得太高,您无法轻易停止程序,并且必须处理一遍又一遍地键入的消息,直到它完成。有没有办法在 运行 停止输入消息时添加选项? 这是代码:
set shell = createobject ("wscript.shell")
strtext = inputbox ("Type the message you like to type")
strtimes = inputbox ("How many times would you like to type this message?")
strspeed = inputbox ("How fast do you like to message? (1000 = one per sec, 100 = 10 per sec etc)")
strtimeneed = inputbox ("How many SECONDS do you need to get to your input box?")
If not isnumeric (strtimes & strspeed & strtimeneed) then
msgbox "You entered something else then a number on Times, Speed and/or Time need. Closing program"
wscript.quit
End If
strtimeneed2 = strtimeneed * 1000
do
msgbox "You have " & strtimeneed & " seconds to get to your input area where you are going to message."
wscript.sleep strtimeneed2
shell.sendkeys ("Hello" & "{enter}")
for i=0 to strtimes
shell.sendkeys (strtext & "{enter}")
wscript.sleep strspeed
Next
shell.sendkeys ("Bye" & "{enter}")
wscript.sleep strspeed * strtimes / 10
returnvalue=MsgBox ("Want to send the messages again with the same info?",36)
If returnvalue=6 Then
Msgbox "Ok Messagebot will activate again"
End If
If returnvalue=7 Then
msgbox "Messaging is shutting down"
wscript.quit
End IF
loop
您可以设置一个快捷方式来终止所有 运行 wscript.exe
进程。在桌面上单击鼠标右键,在上下文菜单中选择新建 - 快捷方式:
输入 %comspec% /c taskkill /f /im wscript.exe
作为位置并单击 下一步:
输入一个你喜欢的名字然后点击完成:
您也可以在快捷方式属性中指定热键。