定時關機小程序
介面:
實現代碼:
代碼如下:
<頭>
<title>定時關機小程序</title>
<hta:應用程序
ApplicationName =“ HTA測試”
borde =“薄”
borderstyle =“凸起”
圖標=“ c:/windows/system32/control.exe”
滾動=“否”
singleSinstance =“是”
最大化布頓=“否”
最小化=“否”
WindowState =“正常”
>
</head>
<腳本語言=“ vbscript”>
sub Window_onload
strcomputer =“。”。
設置objwmiservice = getObject(“ winmgmts://”&strcomputer&“/root/cimv2”)
設置colitems = objwmiservice.execquery(“從win32_desktopmonitor中選擇 *)
對於colitems中的每個objitem
inthorizontal = objitem.screenwidth
intvertical = objitem.screenheight
下一個
intleft =(inthorizontal -240) / 2
inttop =(intvertical -500) / 2
Window.Resizeto 240,500
Window.Moveto intleft,inttop
結束子
sub onesub
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -s -f -t 1800”,0,true)
結束子
亞二ub
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -s -f -t 2700”,0,true)
結束子
sub thrsub
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -s -f -t 3600”,0,true)
結束子
sub確定
如果是iSnumeric(text.value),則
加班= text.value * 60
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -s -f -t”和加班,0,true)
別的
msgbox“請輸入一個有效的數字。”
如果結束
結束子
子關機
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -s -t 0”,0,true)
結束子
子Eshutdown
設置objectshell = createObject(“ wscript.shell”)
ireturn = objectshell.run(“ shutdown -a”,0,true)
結束子
</script>
<身體>
<br>
<center> <div> <input type =“ button” style =“高度:30px; line-height:20px; border:1px實心#AAA;” value =“ 30分鐘後關閉計算機” name =“ run_button” onclick =“ noseub”> <p> </div> </center>
<center> <div> <input type =“ button” style =“高度:30px; line-height:20px; border:1px實心#AAA;” value =“ 45分鐘後關閉計算機” name =“ run_button” onclick =“ twosub”> <p> </div> </center> </div> </center>