定时关机小程序
界面:
实现代码:
代码如下:
<head>
<title>定时关机小程序</title>
<HTA:アプリケーション
ApplicationName = "HTAテスト"
borde = "thin"
BORDERSTYLE = "Raised"
icon = "c:/windows/system32/control.exe"
scroll = "no"
singleInstance = "はい"
MaximizeButton = "no"
minimizebutton = "no"
window -state = "normal"
>
</head>
<スクリプト言語= "vbscript">
sub window_onload
strcomputer = "。"
objwmiservice = getobject( "winmgmts://"&strcomputer& "/root/cimv2")を設定します。
colitems = objwmiservice.execquery( "select * from win32_desktopmonitor")
コリテムの各objitemについて
inthorizontal = objitem.screenwidth
intvertical = objitem.screenheight
次
intleft =(inthorizontal -240) / 2
inttop =(intvertical -500) / 2
window.resizeto 240,500
window.moveto intleft、inttop
End Sub
サブワンサブ
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -s -f -t 1800"、0、true)
End Sub
Sub TwoSub
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -s -f -t 2700"、0、true)
End Sub
サブTHRSUB
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -s -f -t 3600"、0、true)
End Sub
サブOK
is -numeric(text.value)の場合
残業= text.value * 60
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -s -f -t"&overtime、0、true)
それ以外
msgbox "请输入一个有效的数字。"
ifを終了します
End Sub
サブシャットダウン
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -s -t 0"、0、true)
End Sub
サブエシュトゥダウン
Objectshell = createObject( "wscript.shell")を設定します
iReturn = objectshell.run( "shutdown -a"、0、true)
End Sub
</script>
<body>
<br>
<center> <div> <入力タイプ= "ボタン" style = "height:30px; line-height:20px; border:1px solid #aaa;" value = "30分钟后关闭计算机" name = "run_button" onclick = "onesub"> </div> </center>
<center> <div> <入力タイプ= "ボタン" style = "height:30px; line-height:20px; border:1px solid #aaa;" value = "45分钟后关闭计算机" name = "run_button" onclick = "twosub"> <p> </div> </center>