Code: Select all
InputBox, input, Shutdown computer in.. (minutes)
shuttime:= (input * 60) * 1000 ;;Convert to miliseconds
Seconds:= input * 60
Gui, +AlwaysOnTop
Gui, Add, Text,, Computer shutting down in
Gui, Add, Text,, Seconds
Gui, Add, Text,, seconds
Gui, Show, NoActivate, System
Loop {
sleep 1000
Seconds:= Seconds -1
GuiControl,, Seconds, %Seconds%
if(seconds = 0)
break
}
shutdown, 5
return
Hey guys, as you might have guessed I'm trying to make a simple shutdown timer, with a GUI to display how many seconds are left until shutdown, the loop works perfectly fine, I chose one minute and it took exactly one minute to shut down, the problem is that the GuiControl command fails to update the Seconds variable in the GUI, it only works once at first and then it gets stuck on 59 the rest of the time, am I doing something wrong? thanks a lot for always helping