定时关机小程序
: :
: :
代码如下:
<head>
<title> 定时关机小程序 </title>
<hta: التطبيق
ApplicationName = "اختبار HTA"
borde = "رقيقة"
BorderStyle = "Ared"
icon = "c: /windows/system32/control.exe"
Scroll = "لا"
SingleInstance = "نعم"
MailasizedButton = "لا"
MailizeButton = "لا"
WindowState = "Normal"
>
</head>
<script language = "vbscript">
sub window_onload
strcomputer = "."
تعيين OBJWMIService = getObject ("winmgmts: //" & stromputer & "/root/cimv2")
set colitems = objwmiservice.execquery ("SELECT * from win32_desktopmonitor")
لكل objitem في colitems
inthorizontal = objitem.screenwidth
intveRtical = objitem.screenheight
التالي
intleft = (inthorizontal - 240) / 2
inttop = (intvertical - 500) / 2
Window.Resizeto 240،500
window.moveto intleft ، inttop
نهاية الفرعية
Sub One
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("الإغلاق -S -f -t 1800" ، 0 ، صحيح)
نهاية الفرعية
الفرعية twosub
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("STUPHDOWN -S -F -T 2700" ، 0 ، True)
نهاية الفرعية
Thrsub الفرعي
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("Shutdown -S -F -T 3600" ، 0 ، True)
نهاية الفرعية
موافق
إذا isnumeric (text.value) ثم
العمل الإضافي = text.value * 60
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("Shutdown -S -F -T" & العمل الإضافي ، 0 ، صحيح)
آخر
msgbox "请输入一个有效的数字。"
إنهاء إذا
نهاية الفرعية
الإغلاق الفرعي
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("Shutdown -S -T 0" ، 0 ، True)
نهاية الفرعية
sub eshutdown
تعيين ObjectShell = createObject ("wscript.shell")
IRETURN = ObjectShell.run ("stutdown -a" ، 0 ، true)
نهاية الفرعية
</script>
<body>
<br>
<Center> <viv> <input type = "button" style = "الارتفاع: 30px ؛ خط الارتفاع: 20px ؛ الحدود: 1px solid #AAA ؛" value = "30 分钟后关闭计算机" name = "run_button" onClick = "OneSub"> <p> </viv> </center>
<Center> <viv> <input type = "button" style = "الارتفاع: 30px ؛ خط الارتفاع: 20px ؛ الحدود: 1px solid #AAA ؛" value = "45 分钟后关闭计算机" name = "run_button" onClick = "twosub"> <p> </viv> </center>