我在vbscript中创建了一个脚本,该脚本应该在PC启动时打开一个Internet Explorer窗口(播放背景音乐)(我将文件放在shell中:启动),然后在12:30它应该关闭选项卡并打开一个新的以同样的方式,最后在19:00关闭它 . 这两个标签按预期打开但它们没有关闭,两个音频源相互重叠 . 该脚本不能基于杀死IE进程并且必须使用IE选项卡,因为人们使用该机器并且他们必须能够手动停止音频控件,手动关闭选项卡并在脚本运行时使用IE .

Dim time, WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run """c:\program files\internet explorer\iexplore.exe"" http://www.radioitalia.it/player?a=p""",2
time = Now()
hm = Minute(time) + 100 * Hour(time)
While hm < 1230 
    WScript.Sleep(2)
Wend
For Each w In CreateObject("Shell.Application").Windows 
    If InStr(1, w.LocationURL, "radioitalia.it", 1) Then _
        w.Quit()
Next 'w
WshShell.Run """c:\program files\internet explorer\iexplore.exe"" https://www.deejay.it/radio/?refresh_ce&p=a""",2
time = Now()
hm = Minute(time) + 100 * Hour(time)
While hm < 1900 
    WScript.Sleep(2)
Wend
For Each w In CreateObject("Shell.Application").Windows 
    If InStr(1, w.LocationURL, "deejay.it", 1) Then _
      w.Quit()
Next 'w