HockeyFan Posted November 17, 2006 Share Posted November 17, 2006 Can someone help me figure out what I'm doing wrong with this script? All I want to do is have a GUI window with a message and an OK button. When you click on the OK button, the script exits...when you minimize the GUI, the GUI minimizes for a number of seconds and then restores the GUI window. What am I doing wrong here? expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $Font = "Arial Bold" $NoConn = GuiCreate(" Please Note...", 536, 350,-1, -1, -1, $WS_EX_TOPMOST) $NoConnT1 = "Text1" $NoConnT2 = "Text2" $NoConnT3 = "Text3" $NoConnLabel1 = GuiCtrlCreateLabel($NoConnT1, 10, 10, 510, 50, $ES_CENTER) GUICtrlSetFont(-1, 20, 400, 0, $font) GUICtrlSetColor ($NoConnLabel1, 0xff0000) $NoConnLabel2 = GuiCtrlCreateLabel($NoConnT2, 10, 60, 510, 200, $ES_CENTER) GUICtrlSetFont(-1, 12, 400, 0, $font) GUICtrlSetColor ($NoConnLabel2, 0x0000FF) $NoConnLabel3 = GuiCtrlCreateLabel($NoConnT3, 10, 200, 510, 40, $ES_CENTER) GUICtrlSetFont(-1, 12, 400, 0, $font) GUICtrlSetColor ($NoConnLabel3, 0x000080) $NoConnButton1 = GuiCtrlCreateButton("OK", 210, 270, 120, 30) GUICtrlSetOnEvent($NoConnButton1, "_Exit") GUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize") GuiSetState() While 1 Sleep(1000) WEnd Exit Func _Exit() Exit EndFunc Func Minimize() Sleep(1000) SoundPlay(@WindowsDir & "\media\Windows XP Balloon.wav",1) GUISetState(@SW_RESTORE, $NoConn) EndFunc Link to comment Share on other sites More sharing options...
Valuater Posted November 17, 2006 Share Posted November 17, 2006 maybe... expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) ; Change to OnEvent mode $Font = "Arial Bold" $NoConn = GuiCreate(" Please Note...", 536, 350,-1, -1, -1, $WS_EX_TOPMOST) $NoConnT1 = "Text1" $NoConnT2 = "Text2" $NoConnT3 = "Text3" $NoConnLabel1 = GuiCtrlCreateLabel($NoConnT1, 10, 10, 510, 50, $ES_CENTER) GUICtrlSetFont(-1, 20, 400, 0, $font) GUICtrlSetColor ($NoConnLabel1, 0xff0000) $NoConnLabel2 = GuiCtrlCreateLabel($NoConnT2, 10, 60, 510, 200, $ES_CENTER) GUICtrlSetFont(-1, 12, 400, 0, $font) GUICtrlSetColor ($NoConnLabel2, 0x0000FF) $NoConnLabel3 = GuiCtrlCreateLabel($NoConnT3, 10, 200, 510, 40, $ES_CENTER) GUICtrlSetFont(-1, 12, 400, 0, $font) GUICtrlSetColor ($NoConnLabel3, 0x000080) $NoConnButton1 = GuiCtrlCreateButton("OK", 210, 270, 120, 30) GUICtrlSetOnEvent($NoConnButton1, "_Exit") GuiSetState() GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimizer") While 1 Sleep(1000) WEnd Exit Func _Exit() Exit EndFunc Func Minimizer() GUISetState(@SW_MINIMIZE, $NoConn) Sleep(1000) SoundPlay(@WindowsDir & "\media\Windows XP Balloon.wav",1) GUISetState(@SW_RESTORE, $NoConn) EndFunc 8) Link to comment Share on other sites More sharing options...
HockeyFan Posted November 17, 2006 Author Share Posted November 17, 2006 maybe... Thank you!! Can I ask why you moved... GUISetOnEvent($GUI_EVENT_MINIMIZE, "Minimizer")oÝ÷ Ù§íz¶®¶sdwV6WE7FFR Was my problem that I didn't set the state of the window, I was just activated a function that actually minimized the window? Is that why my function call didn't work? Trying to learn from my mistakes. Thanks again! Link to comment Share on other sites More sharing options...
Valuater Posted November 17, 2006 Share Posted November 17, 2006 You usedGUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")I moved it outside the GUISetState() just to let you see theGUISetOnEvent() ( no CTRL )8) Link to comment Share on other sites More sharing options...
HockeyFan Posted November 17, 2006 Author Share Posted November 17, 2006 (edited) You usedGUICtrlSetOnEvent($GUI_EVENT_MINIMIZE, "Minimize")I moved it outside the GUISetState() just to let you see theGUISetOnEvent() ( no CTRL )8)OH!!!! I totally missed that! Sorry...and thank you so much once again!!! Edited November 17, 2006 by HockeyFan Link to comment Share on other sites More sharing options...
Valuater Posted November 17, 2006 Share Posted November 17, 2006 OH!!!! I totally missed that! Sorry...and thank you so much once again!!! Welcome!8) 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