ttleser Posted August 20, 2007 Share Posted August 20, 2007 (edited) Ok, maybe you guys can help me out, I'm just missing something (maybe I'm tired). Got a script that windows scheduler will open and run at a certain time. The script is just a reminder script that will flash text and play an audio file every 10secs until the window is closed. Problem with my script is I can't close the window!!! I've got everything else working. Help? expandcollapse popup#include <GuiConstants.au3> #include <Sound.au3> GUICreate("Reminder",200,100) $text = GUICtrlCreateLabel("",10,5,180,50) $exit = GUICtrlCreateButton("Exit", 75, 75, 50, 23) $sound = _SoundOpen("Reminder.wav", "Startup") GUISetState () while 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $exit Exit EndSelect If $msg <> $GUI_EVENT_CLOSE Or $exit Then play() Sleep(1000) Flash_text() Else Exit EndIf wend Func play() _SoundPlay($sound, 0) EndFunc Func Flash_text() GUICtrlSetData ($text," text here") sleep(2000) GUICtrlSetData ($text,"") sleep(1000) GUICtrlSetData ($text," text here") sleep(2000) GUICtrlSetData ($text,"") sleep(1000) EndFunc Edited August 20, 2007 by ttleser Link to comment Share on other sites More sharing options...
Reaper HGN Posted August 20, 2007 Share Posted August 20, 2007 It looks like your program is in the loop most of the time when you are hitting the exit or gui close. I took your code and converted to OnEvent mode which seems to solve the problem. expandcollapse popup#include <GuiConstants.au3> #include <Sound.au3> Opt("GUIOnEventMode", 1) GUICreate("Reminder",200,100) $text = GUICtrlCreateLabel("",10,5,180,50) $exit = GUICtrlCreateButton("Exit", 75, 75, 50, 23) $sound = _SoundOpen("Reminder.wav", "Startup") GUISetState () GUISetOnEvent($GUI_EVENT_CLOSE, "_Quit") GUICtrlSetOnEvent($exit, "_Quit") While 1 sleep(1000) play() Sleep(100) Flash_text() WEnd Func _Quit() Exit EndFunc Func play() _SoundPlay($sound, 0) EndFunc Func Flash_text() GUICtrlSetData ($text," text here") sleep(2000) GUICtrlSetData ($text,"") sleep(1000) GUICtrlSetData ($text," text here") sleep(2000) GUICtrlSetData ($text,"") sleep(1000) EndFunc Link to comment Share on other sites More sharing options...
ttleser Posted August 20, 2007 Author Share Posted August 20, 2007 Thanks Reaper, I figured it was something simple I was missing. Link to comment Share on other sites More sharing options...
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