mtmartis Posted November 10, 2009 Share Posted November 10, 2009 I am creating a dialog box for a an installation. The top test is set to "Blink" using the following code. My issue is I need to slow down the "blinking" by increasing the Sleep() duration, but when I do, I think the loop overlaps and when I click the Close Window Button, nothing happens. Any ideas would be greatly appreciated! NOTE: I am still learning AutoIt scripting, so try not to tear me a new one, thanks! #include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Install", 500, 335, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU)) GUISetBkColor(0xDCDCDC) $button = GUICtrlCreateButton ("Close Window", 175, 285,150,20,$ES_CENTER) GUICtrlSetState(-1,$GUI_FOCUS) GUISetFont (25, 999,-1, "Verdana"); will display underlined characters $label = GUICtrlCreateLabel (@CRLF & "IMPORTANT REMINDER!!!",1,1,500,85,$ES_CENTER) GUISetState () $right = 0 While 1 $msg = GUIGetMsg() If $msg = $button Or $msg = $GUI_EVENT_CLOSE then Exit If $right = 0 then $right = 1 GUICtrlSetColor($label,0xFF0000) ; Red else $right = 0 GUICtrlSetColor($label,0xDCDCDC) ; BKGround endif sleep(250) Wend Exit Link to comment Share on other sites More sharing options...
Developers Jos Posted November 10, 2009 Developers Share Posted November 10, 2009 2 options: 1. use eventmode for the button. 2. Use Adlib function for the blinking and get rid of the sleep() in the GUImessageloop 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. Link to comment Share on other sites More sharing options...
Mison Posted November 11, 2009 Share Posted November 11, 2009 If you don't want to learn adlib or event mode yet, this script should do the trick... expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Install", 500, 335, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU)) GUISetBkColor(0xDCDCDC) $button = GUICtrlCreateButton ("Close Window", 175, 285,150,20,$ES_CENTER) GUICtrlSetState(-1,$GUI_FOCUS) GUISetFont (25, 999,-1, "Verdana"); will display underlined characters $label = GUICtrlCreateLabel (@CRLF & "IMPORTANT REMINDER!!!",1,1,500,85,$ES_CENTER) GUISetState () $global_sleep = 10 ; change main loop sleep duration here $blink_sleep = 250 ; change blink sleep duration here $total_blink_sleep = 0 $right = 0 While 1 $msg = GUIGetMsg() If $msg = $button Or $msg = $GUI_EVENT_CLOSE then Exit If $total_blink_sleep >= $blink_sleep Then $total_blink_sleep = 0 ; reset total blink sleep If $right = 0 then $right = 1 GUICtrlSetColor($label,0xFF0000) ; Red else $right = 0 GUICtrlSetColor($label,0xDCDCDC) ; BKGround EndIf Else $total_blink_sleep = $total_blink_sleep + $global_sleep EndIf sleep($global_sleep) Wend Exit Hi ;) Link to comment Share on other sites More sharing options...
mtmartis Posted November 11, 2009 Author Share Posted November 11, 2009 If you don't want to learn adlib or event mode yet, this script should do the trick... expandcollapse popup#include <GUIConstants.au3> #include <WindowsConstants.au3> #include <EditConstants.au3> GUICreate("Install", 500, 335, -1, -1, BitOR($WS_POPUP, $WS_CAPTION, $WS_SYSMENU)) GUISetBkColor(0xDCDCDC) $button = GUICtrlCreateButton ("Close Window", 175, 285,150,20,$ES_CENTER) GUICtrlSetState(-1,$GUI_FOCUS) GUISetFont (25, 999,-1, "Verdana"); will display underlined characters $label = GUICtrlCreateLabel (@CRLF & "IMPORTANT REMINDER!!!",1,1,500,85,$ES_CENTER) GUISetState () $global_sleep = 10 ; change main loop sleep duration here $blink_sleep = 250 ; change blink sleep duration here $total_blink_sleep = 0 $right = 0 While 1 $msg = GUIGetMsg() If $msg = $button Or $msg = $GUI_EVENT_CLOSE then Exit If $total_blink_sleep >= $blink_sleep Then $total_blink_sleep = 0 ; reset total blink sleep If $right = 0 then $right = 1 GUICtrlSetColor($label,0xFF0000) ; Red else $right = 0 GUICtrlSetColor($label,0xDCDCDC) ; BKGround EndIf Else $total_blink_sleep = $total_blink_sleep + $global_sleep EndIf sleep($global_sleep) Wend Exit Mison, I did look at adlib and event mode for a few hours, and you are correct, I am not ready for that just yet. I appreciate your help! It's going to take a bit for me to completely understand what the loop is doing. Loops just don't make sense to me for some reason. Thanks again!!! 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