定时关机小程序
界面:
实现代码:
代码如下:
<头>
<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>