定时关机小程序
界面:
实现代码:
代码如下:
<head>
<title> 定时关机小程序 </title>
<HTA: แอปพลิเคชัน
ApplicationName = "HTA Test"
Borde = "Thin"
Borderstyle = "ยก"
icon = "c: /windows/system32/control.exe"
Scroll = "ไม่"
singleinstance = "ใช่"
MaximizeButton = "ไม่"
minimizeButton = "ไม่"
WindowState = "ปกติ"
-
</head>
<ภาษาสคริปต์ = "vbscript">
sub window_onload
strcomputer = "."
ตั้งค่า objwmiservice = getObject ("winmgmts: //" & strcomputer & "/root/cimv2"))
ตั้งค่า colitems = objwmiservice.execQuery ("เลือก * จาก 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, intop
สิ้นสุดย่อย
sub onesub
ตั้งค่า objectShell = createObject ("wscript.shell")
ireturn = ObjectShell.run ("ปิด -s -f -t 1800", 0, true)
สิ้นสุดย่อย
sub twosub
ตั้งค่า 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)
สิ้นสุดย่อย
ย่อยตกลง
ถ้า isnumeric (text.value) แล้ว
ค่าล่วงเวลา = text.value * 60
ตั้งค่า objectShell = createObject ("wscript.shell")
ireturn = objectshell.run ("shutdown -s -f -t" & overtime, 0, true)
อื่น
msgbox "请输入一个有效的数字。"
สิ้นสุดถ้า
สิ้นสุดย่อย
ปิดเครื่องย่อย
ตั้งค่า objectShell = createObject ("wscript.shell")
ireturn = ObjectShell.run ("ปิด -S -T 0", 0, true)
สิ้นสุดย่อย
sub eshutdown
ตั้งค่า objectShell = createObject ("wscript.shell")
ireturn = objectshell.run ("ปิด -a", 0, true)
สิ้นสุดย่อย
</script>
<body>
<br>
<center> <div> <อินพุตประเภท = "ปุ่ม" สไตล์ = "ความสูง: 30px; สายไฟ: 20px; เส้นขอบ: 1px ของแข็ง #aaa;" value = "30 分钟后关闭计算机" name = "run_button" onclick = "onesub"> <p> </div> </enter>
<center> <div> <อินพุตประเภท = "ปุ่ม" สไตล์ = "ความสูง: 30px; สายไฟ: 20px; เส้นขอบ: 1px ของแข็ง #aaa;" value = "45 分钟后关闭计算机" name = "run_button" onclick = "twosub"> <p> </div> </enter>