while循环表现得很奇怪

时间:2015-08-15 12:40:11

标签: vbscript wsh

我即将编写一些VBScript来执行某些操作:

Set WshShell = WScript.CreateObject("WScript.Shell")
WScript.Sleep 6000 
while k < 5
    while h < 5
        while j < 20
            while i < 70
                WScript.Sleep 1000 '*1s
                WshShell.SendKeys "M"
                i = i+1
            wend
            WshShell.SendKeys "{right}"
            WScript.Sleep 30000 '*30s
            WshShell.SendKeys "{F5}"
            WshShell.SendKeys "--------------------------------------"
            WScript.Sleep 6000 '*6s
            j = j + 1
        wend
        WshShell.SendKeys "{right}"
        WScript.Sleep 900000 '*15min
        WshShell.SendKeys "{F5}"  '* F5 let print the actual date in ms notepad
        WScript.Sleep 6000 '*6s
        h = h + 1
    wend
    WScript.Sleep 2500000 '*41min
    k = k + 1
wend

当我运行脚本并让输出传递到文本文件时,文件如下所示。真正奇怪的是,脚本没有运行这些70 M,实际上我相信它不能在while循环中运行while循环。

MMMMMMMMMMMMMMMMMMMM12:29 15.08.2015
--------------------------------------12:29 15.08.2015 //line 1
--------------------------------------12:30 15.08.2015
--------------------------------------12:30 15.08.2015
--------------------------------------12:30 15.08.2015
--------------------------------------12:31 15.08.2015
--------------------------------------12:31 15.08.2015
--------------------------------------12:31 15.08.2015
--------------------------------------12:32 15.08.2015
--------------------------------------12:32 15.08.2015
--------------------------------------12:32 15.08.2015
--------------------------------------12:32 15.08.2015
--------------------------------------12:33 15.08.2015
--------------------------------------12:33 15.08.2015
--------------------------------------12:33 15.08.2015
--------------------------------------12:34 15.08.2015
--------------------------------------12:34 15.08.2015
--------------------------------------12:34 15.08.2015
--------------------------------------12:35 15.08.2015
--------------------------------------12:35 15.08.2015
--------------------------------------12:35 15.08.2015
--------------------------------------12:35 15.08.2015
--------------------------------------12:36 15.08.2015
--------------------------------------12:36 15.08.2015
--------------------------------------12:36 15.08.2015
--------------------------------------12:37 15.08.2015
--------------------------------------12:37 15.08.2015
--------------------------------------12:37 15.08.2015
--------------------------------------12:38 15.08.2015
--------------------------------------12:38 15.08.2015
--------------------------------------12:38 15.08.2015
--------------------------------------12:38 15.08.2015
--------------------------------------12:39 15.08.2015
--------------------------------------12:39 15.08.2015
--------------------------------------12:39 15.08.2015
--------------------------------------12:40 15.08.2015
--------------------------------------12:40 15.08.2015
--------------------------------------12:41 15.08.2015
--------------------------------------12:55 15.08.2015 //line 37
12:56 15.08.2015
13:10 15.08.2015
13:11 15.08.2015
13:25 15.08.2015
13:26 15.08.2015
13:40 15.08.2015
13:41 15.08.2015
13:55 15.08.2015
13:56 15.08.2015

即使是时间差异btw。每个打印动作都非常奇怪,或者这些“-----”打印了37次,然后只有日期才能得到这37个循环,我完全糊涂了。

有没有人知道类似的问题或知道如何处理这个问题,脚本正是按照我的意愿行事?

0 个答案:

没有答案