0

这是我的脚本

Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
wscript.sleep 1800000
do
    if colCDROMs.Count >=1 then
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
    End if
    wscript.sleep 600000
loop

我要让它在启动 30 分钟后和每十分钟后弹出 cd 托盘,我想知道的是如何在大约 3 个循环后打开某个文本文件?

4

1 回答 1

0

它的价值...这将file在 CD 抽屉第三次打开后每次打开文本文件。如果你愿意,你可以将计数设置回零......

Set oWMP = CreateObject("WMPlayer.OCX.7")
Set colCDROMs = oWMP.cdromCollection
wscript.sleep 1800000
count = 0
do
    if colCDROMs.Count >=1 then
        count = count + 1
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
        For i = 0 to colCDROMs.Count - 1
            colCDROMs.Item(i).Eject
        Next
    End if
    If count >= 3 Then
      file = "c:\path\to\my\file.txt"
      CreateObject("WScript.Shell").Run "notepad.exe """ & file & """"
    end if
    wscript.sleep 600000
loop
于 2013-11-16T13:15:51.880 回答