返回列表 发帖

[问题求助] 求助vbs循环执行指定秒数后停止工作的代码没有正常循环是什么原因

本帖最后由 pcl_test 于 2016-9-13 20:10 编辑

老师节日好!!
    以下123.VBS 如下,只运行了一次循环体就停止工作,而不是循环执行160秒后停止工作,不知错在何处请指教?
                                                                                      谢谢!!
123.VBS:
Dim strPrgpth
strPrgpth = """e:\工具\武侠.exe"""
Set wshshell = CreateObject("wscript.shell")
Set oexec = wshshell.exec(strPrgpth)
t=timer
do while timer-t<160
    wscript.sleep 1000
    wshshell.Sendkeys "{ENTER}"
    wscript.sleep 30000
    wshshell.Sendkeys "{ENTER}"
    process.Terminate
loopCOPY

Dim strPrgpth
strPrgpth = """e:\工具\武侠.exe"""
Set wshshell = CreateObject("wscript.shell")
Set oexec = wshshell.exec(strPrgpth)
t=timer
do while timer-t<160
    wscript.sleep 1000
    wshshell.Sendkeys "{ENTER}"
    wscript.sleep 30000
    wshshell.Sendkeys "{ENTER}"
loop
process.TerminateCOPY
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

回复 2# yu2n


谢谢yu2n老师解答!!我用了还是不行,还请费心!

TOP

Dim strPrgpth
strPrgpth = """%WinDir%\NOTEPAD.EXE"""
Set wshshell = CreateObject("wscript.shell")
Set oexec = wshshell.exec(strPrgpth)
t = Timer
Do While Timer - t < 5
    wscript.sleep 1000
    wshshell.Sendkeys "{ENTER}"
    wscript.sleep 3000
    wshshell.Sendkeys "{ENTER}"
loop
oexec.TerminateCOPY
1

评分人数

    • hnldwhm52: 谢谢yu2n老师解决!!技术 + 1
『千江有水千江月』千江有水,月映千江;万里无云,万里青天。    http://yu2n.qiniudn.com/

TOP

返回列表