返回列表 发帖

[问题求助] [已解决]VBS如何循环关闭指定网页并设置倒计时关机?

[已解决]倒计时10分钟关机,循环6秒检测。这2个动作,同步/同时进行。vbs如何实现?

vbs代码,运行1次,就后台循环6秒监控ie地址栏。
1、第一次发现有满足条件的ie地址栏,就关闭ie页面。
并且开始倒计时10分钟,自动关机。
2、同时继续循环6秒检测ie地址栏是否满足条件。发现满足,还是继续关闭IE页面
1

评分人数

    • pcl_test: 勿发笼统无意义的标题PB -4

如果使用 shutdown -s 关机时间不覆盖上次的关机计划
#&cls&@powershell "Invoke-Expression ([Io.File]::ReadAllText('%~0',[Text.Encoding]::UTF8))" &pause&exit

TOP

回复 2# ivor


    问题解决了。。。
2个vbs搭配。。

shut-ie.vbs
on error resume next
kill4399 = "4399.com"
killxp = "http://xp.4399.com/"
kill7k7k = "7k7k.com"
killnews = "http://news.7k7k.com"
killxyx = "http://xyx.hao123.com"
killgame = "http://game.hao123.com/"
set sh = CreateObject("Shell.Application")
Set k = CreateObject("Wscript.Shell")
set wnds = sh.windows()
Set Shell=CreateObject("Shell.Application")
on error resume next
while(true) 'By:原始程序林小七 2014.1.30,改版:9zhmke
    for each wnd in wnds
        if InStr(wnd.LocationURL, kill4399) or InStr(wnd.LocationURL, killxp) or InStr(wnd.LocationURL, kill7k7k) or InStr(wnd.LocationURL, killnews) or InStr(wnd.LocationURL, killxyx) or InStr(wnd.LocationURL, killgame) then
Wscript.Sleep 300000
                wnd.quit
WScript.CreateObject("wscript.shell").Run "shut-ie-djs.vbs", 0,false
         end if
    next
Wend
on error goto 0
'Shell.ShellExecute "wscript.exe", Chr(34) &  'WScript.ScriptFullName & 'Chr(34) & '" uac", "", "runas", 1COPY

TOP

shut-ie-djs.vbs
Wscript.Sleep 600000
WScript.CreateObject("wscript.shell").Run "shutdown /f /s /t 1", 0,falseCOPY

TOP

返回列表