Jump to content

Autoshut Down Script That Allows Me To Enter The Time I Want It To Shut Down


Recommended Posts

Hi

I want to create a Auto Shutdown script to close my computer and I want to be able to enter the time I want it to shut down

#NoTrayIcon

Sleep(60000)

Shutdown(13)

How do I create that? When ever I run it, it will pop up and ask me how many minutes or hours I want it to shutdown

Link to comment
Share on other sites

Designed to run a "task" and time/day settings from an ini file but you can modify it..

$g_szVersion = "QShed"
If WinExists($g_szVersion) Then Exit; It's already running
AutoItWinSetTitle($g_szVersion)

Opt("TrayAutoPause",0)
Opt("TrayMenuMode",1)

$days = IniRead ("Qshed.ini" , "General" , "Days", "Sun")
$ShedTime = Number (IniRead ("Qshed.ini" , "General" , "Time", "0300"))

Local $aDayOfWeek[8]
    
    $aDayOfWeek[1] = "Sun"
    $aDayOfWeek[2] = "Mon"
    $aDayOfWeek[3] = "Tue"
    $aDayOfWeek[4] = "Wed"
    $aDayOfWeek[5] = "Thu"
    $aDayOfWeek[6] = "Fri"
    $aDayOfWeek[7] = "Sat"

$aDays = Stringsplit ($Days, ",")
While 1
    $CurrentTime = Number (@Hour & @Min)
    For $i = 1 to Ubound ($aDays) -1

     If $aDays[$i] =  $aDayOfWeek[@WDAY] Then
        If Number ($CurrentTime) = Number ($ShedTime) Then
        MsgBox  (0,"Run","Run the scheduled task here but sleep for 1 minute after run to avoid running twice")
        Sleep (60000)
        EndIf
     Endif
     Sleep (1000)
     Next
Wend
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...