So I have a program that updates software on an end user device. When it comes time for a reboot it will utilize the following script:
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
$r = "2"
_main()
Func _main()
$MyGUI = GUICreate("Reboot Needed", 493, 120, 192, 114)
$Message = GUICtrlCreateLabel("Windows needs to reboot your system to complete system changes. Please save your work and click" & @CRLF & "Reboot. Or click Delay to Postpone the operation for 30 minutes. You may postpone " & $r & " more times.", 0, 8, 601, 75)
$Button1 = GUICtrlCreateButton("Reboot", 50, 70, 153, 41)
$Button2 = GUICtrlCreateButton("Delay", 300, 70, 137, 41)
GUISetState(@SW_SHOW)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
_main()
Case $Button1
Shutdown(6)
Case $Button2
GUIDelete()
_delay()
EndSwitch
WEnd
EndFunc
Func _delay()
$r -= 1
Sleep(10000)
_main()
EndFunc
What I need is a timeout on this box. Say if the user doesn't select Reboot or Delay within 30 seconds it will default to rebooting the device. Is this possible and if so how would I go about it?
Thanks!