定时关机小程序
界面 :
实现代码 :
代码如下:
<Evista>
<title> 定时关机小程序 </title>
<HTA: aplicación
ApplicationName = "Test HTA"
Borde = "delgado"
Borderstyle = "elevado"
Icon = "c: /windows/system32/control.exe"
Scroll = "No"
SingleInstance = "Sí"
MaximizeButton = "no"
MinimizeButton = "no"
WindowState = "Normal"
>
</ablo>
<script language = "VBScript">
Sub Window_onload
strcomputer = "."
Establecer objwmiservice = getObject ("winmgmts: //" & strcomputer & "/root/cimv2")
Establecer colitems = objwmiservice.execquery ("Seleccione * de Win32_DeskTopMonitor")
Para cada objitem en colitems
inthorizontal = objitem.screenwidth
intvertical = objitem.screenheight
Próximo
intleft = (inthorizontal - 240) / 2
inttop = (intvertical - 500) / 2
Window.resizeto 240,500
Window.moveto intleft, inttop
Final
Subsub
Establecer ObjectShell = CreateObject ("wscript.shell")
Ireturn = ObjectShell.run ("apagado -s -f -t 1800", 0, verdadero)
Final
Sub dos
Establecer ObjectShell = CreateObject ("wscript.shell")
Ireturn = ObjectShell.run ("apagado -s -f -t 2700", 0, verdadero)
Final
Subthrsub
Establecer ObjectShell = CreateObject ("wscript.shell")
Ireturn = ObjectShell.run ("apagado -s -f -t 3600", 0, verdadero)
Final
SUB OK
If isnumérico (text.value) entonces
Tiempo extra = text.value * 60
Establecer ObjectShell = CreateObject ("wscript.shell")
Ireturn = ObjectShell.run ("Stardown -s -f -t" y tiempo extra, 0, verdadero)
Demás
Msgbox "请输入一个有效的数字。"
Final si
Final
Subpuesto
Establecer ObjectShell = CreateObject ("wscript.shell")
Ireturn = ObjectShell.run ("apagado -s -t 0", 0, verdadero)
Final
Subhutdown
Establecer ObjectShell = CreateObject ("wscript.shell")
ireturn = ObjectShell.run ("apagado -a", 0, verdadero)
Final
</script>
<Body>
<br>
<center> <div> <input type = "button" style = "altura: 30px; line-height: 20px; border: 1px sólido #aaa;" value = "30 分钟后关闭计算机" name = "run_button" onClick = "andaub"> <p> </div> </center>
<center> <div> <input type = "button" style = "altura: 30px; line-height: 20px; border: 1px sólido #aaa;" valor = "45 分钟后关闭计算机" name = "run_button" onClick = "twosub"> <p> </div> </center>