Jump to content

Recommended Posts

Posted

hallo,

Is it possible to get some buttons on progressbar ?

Shutdowntimer(180)

Func ShutdownTimer($Time)
    local $hr = $Time/60
    local $sec = $Time * 60
    local $step = 100 / $sec
    ProgressOn("", "Reboot Time in : " & $sec & " seconds", "", -1, -1, 16)
    For $i = 0 To 100 Step $step
        $sec = $sec - 1
        $Time = round($Time - 1/60, 2)
        Sleep(1000)
            If $Time > 2 Then
                ProgressSet($i, $Time & " minutes left before reboot." ) 
            Else
                ProgressSet($i, $sec & " seconds left before reboot." )
        EndIf 
    Next
    Shutdown(2) ; Reboot pc
EndFunc

If there is also a button the shutdown progress can take right away and you don't have to wait.

Posted (edited)

You could use Opt("GUIOnEventMode", 1) to control the buttons, and when clicked, it would do what you need.

I looked at your code, and had a better idea. Just use a hotsetkey to do what you need.

HotKeySet("^!x", "_exit")
Shutdowntimer(10)

Func ShutdownTimer($Time)
    local $hr = $Time/60
    local $sec = $Time * 60
    local $step = 100 / $sec
    ProgressOn("", "Reboot Time in : " & $sec & " seconds", "", -1, -1, 16)
    For $i = 0 To 100 Step $step
        $sec = $sec - 1
        $Time = round($Time - 1/60, 2)
        Sleep(1000)
            If $Time > 2 Then
                ProgressSet($i, $Time & " minutes left before reboot." ) 
            Else
                ProgressSet($i, $sec & " seconds left before reboot." )
        EndIf 
    Next
    ;Shutdown(2) ; Reboot pc
EndFunc

func _Exit()
    Exit
EndFunc
Edited by vollyman

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
×
×
  • Create New...