hta实现的定时关机小程序

随心笔谈1年前发布 编辑
148 0

定时关机小程序

     APPLICATIONNAME=”HTA Test”

  Borde=”thin”

  BorderStyle=”raised”

  ICON=”C:\WINDOWS\SYSTEM32\control.exe”

     SCROLL=”no”

     SINGLEINSTANCE=”yes”

  MaximizeButton=”no”

  MinimizeButton=”no”

     WINDOWSTATE=”normal”

>

 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 “请输入一个有效的数字。”

  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

 自定义时间(分钟):

© 版权声明

相关文章