billrr02 Posted March 12, 2014 Posted March 12, 2014 How do I force this MsgBox to pop up again after a specified amount of time (let's say 5 minutes) when a user clicks "No"? Currently it simply exits the program, but I want it to be annoying and pop up until the user chooses to restart, . When a user clicks "Yes", it will restart the computer. $answer = MsgBox(69684, "Title" , "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer=7 Then Exit EndIf Shutdown(6) Any help would be appreciated. Thank you!
Developers Solution Jos Posted March 12, 2014 Developers Solution Posted March 12, 2014 mmm that shouldn't be too difficult. Here's something to play with: While 1 $answer = MsgBox(69684, "Title", "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer = 6 Then Shutdown(6) Sleep(1000 * 60 * 5) WEnd Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
JCEF Posted March 12, 2014 Posted March 12, 2014 Good night!I think this is what you want .... Global $answer FuncMsg() Func FuncMsg() $answer = MsgBox(69684, "Title", "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer = 7 Then Sleep(30000) ; Time to wait FuncMsg() Else ;MsgBox(0,"", "Reboot") Shutdown(6) EndIf EndFunc ;==>FuncMsg Hope this helps.
Developers Jos Posted March 13, 2014 Developers Posted March 13, 2014 Good night!I think this is what you want .... Global $answer FuncMsg() Func FuncMsg() $answer = MsgBox(69684, "Title", "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer = 7 Then Sleep(30000) ; Time to wait FuncMsg() Else ;MsgBox(0,"", "Reboot") Shutdown(6) EndIf EndFunc ;==>FuncMsg Hope this helps. Don't think this is what he wants as this example reruns FuncMsg() without ending it and will ultimately get a StackOverflow. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
czardas Posted March 13, 2014 Posted March 13, 2014 You could try using AdlibRegister(). operator64 ArrayWorkshop
billrr02 Posted March 13, 2014 Author Posted March 13, 2014 mmm that shouldn't be too difficult. Here's something to play with: While 1 $answer = MsgBox(69684, "Title", "Test Message." & @CR & "" & @CR & "Would you like to restart now?") If $answer = 6 Then Shutdown(6) Sleep(1000 * 60 * 5) WEnd Jos This worked perfectly. Thanks
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now