Sign in to follow this  
Followers 0
tradertt

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

7 posts in this topic

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Something like this should work:

$time = InputBox("Shutdown", "How many seconds do you want to wait?")
Run("Shutdown -s -f -t " & $time)

Share this post


Link to post
Share on other sites

Should Shutdown -s - f -t be the same as Shutdown (13) ?

It would be the same as Shutdown(5)

Share this post


Link to post
Share on other sites

Would it be able to do Shutdown ( 1 + 4 + 8) ?

I'm not sure what the power down option is for, but it will turn the computer off if that is what you are asking.

Share this post


Link to post
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
Sign in to follow this  
Followers 0