A timer shutdown applet implemented by HTA _hta

Source: Internet
Author: User

Timer Shutdown Applet

Interface:



Implementation code:

Copy Code code as follows:

<title> Timing Shutdown Applet </title>
Applicationname= "HTA Test"
Borde= "Thin"
Borderstyle= "Raised"
icon= "C:\WINDOWS\SYSTEM32\control.exe"
Scroll= "No"
Singleinstance= "Yes"
Maximizebutton= "No"
Minimizebutton= "No"
Windowstate= "Normal"
>
<script language= "VBScript" >
Sub Window_onload
StrComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\cimv2")
Set colitems = objWMIService.ExecQuery ("SELECT * from Win32_DesktopMonitor")
For each objitem in colitems
Inthorizontal = Objitem.screenwidth
Intvertical = Objitem.screenheight
Next
Intleft = (intHorizontal-240)/2
Inttop = (intVertical-500)/2
Window.resizeto 240,500
Window.moveto Intleft, Inttop
End Sub
Sub onesub
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("shutdown-s-f-t 1800", 0, TRUE)
End Sub

Sub twosub
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("Shutdown-s-f-t 2700", 0, TRUE)
End Sub

Sub thrsub
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("Shutdown-s-f-t 3600", 0, TRUE)
End Sub

Sub OK
If IsNumeric (Text.value) Then
Overtime = Text.value * 60
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("Shutdown-s-f-t" & overtime, 0, TRUE)
Else
MsgBox "Please enter a valid number. "
End If
End Sub

Sub ShutDown
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("shutdown-s-T 0", 0, TRUE)
End Sub

Sub Eshutdown
Set Objectshell=createobject ("Wscript.Shell")
Ireturn = Objectshell.run ("Shutdown-a", 0, TRUE)
End Sub

</script>
<body>
<br>
<center><div><input type= "button" style= "height:30px;line-height:20px;border:1px solid #aaa;" value= "Turn off computer after 30 minutes" name= "Run_button" onclick= "Onesub" ><p> </div></center>
<center><div><input type= "button" style= "height:30px;line-height:20px;border:1px solid #aaa;" value= "Turn off computer after 45 minutes" name= "Run_button" onclick= "Twosub" ><p> </div></center>
<center><div><input type= "button" style= "height:30px;line-height:20px;border:1px solid #aaa;" value= "Turn off computer after 60 Minutes" name= "Run_button" onclick= "Thrsub" ><p> </div></center>
<br>
Custom Time (minutes):<p>
<input type= "text" name= "text" id= "text" style= "height:23px;width:120px;line-height:20px;border:1px solid #aaa;" />
<input name= "Submit" type= "submit" style= width:50px;height:23px;line-height:20px;border:1px solid #aaa; "Value=" OK "onclick=" OK ><p>
<br>
<center><div><input type= "button" style= "height:30px;line-height:20px;border:1px solid #aaa;" value= "Cancel scheduled Logoff" Name= "Run_button" onclick= "Eshutdown" ><p> </div></center>
<center><div><input type= "button" style= "height:30px;line-height:20px;border:1px solid #aaa;" value= "Turn Off Computer" name= "Run_button" onclick= "ShutDown" ><p> </div></center>
<br>
<center><div><a href= "http://www.enun.net/" >http://www.enun.net/</a></div></ Center>
</body>


Packaged Downloads: Dsgj_jb51.rar

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.