GtHoo Posted April 11, 2012 Share Posted April 11, 2012 Hi I need to "fix" my script. The time is jumping back, then forward to the new time. The exit button in the corner does not work. Can someone help me? #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $gui = GUICreate("", 290, 70) GUISetState(@SW_SHOW) While 1 $msg = GUIGetMsg() $sec = ":" & @SEC $time = @hour & ":" & @MIN $label1 = GUICtrlCreateLabel ("" & $time, 10, 10) $label2 = GUICtrlCreateLabel ("" & $sec, 40, 10) Select Case $msg = $GUI_EVENT_CLOSE EndSelect WEnd Link to comment Share on other sites More sharing options...
hannes08 Posted April 11, 2012 Share Posted April 11, 2012 (edited) Hi GtHoo, Create you labels before you enter the inifinite loop and set the data via GuiCtrlSetData. #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> $gui = GUICreate("", 290, 70) $label1 = GUICtrlCreateLabel ("", 10, 10) $label2 = GUICtrlCreateLabel ("", 40, 10) GUISetState(@SW_SHOW) While 1 $sec = ":" & @SEC $time = @hour & ":" & @MIN $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect GUICtrlSetData($label1, $time) GUICtrlSetData($label2, $sec) WEnd Edited April 11, 2012 by hannes08 Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
GtHoo Posted April 11, 2012 Author Share Posted April 11, 2012 (edited) I did get a new problem. I can't see the whole time. Is it just me, er for you to? Edited April 11, 2012 by GtHoo Link to comment Share on other sites More sharing options...
hannes08 Posted April 11, 2012 Share Posted April 11, 2012 You'll have to set the width and height of your labels as well. Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
GtHoo Posted April 11, 2012 Author Share Posted April 11, 2012 It works. Tnx Link to comment Share on other sites More sharing options...
Belini Posted April 11, 2012 Share Posted April 11, 2012 (edited) Another option would be this: #include <GUIConstants.au3> AutoItSetOption("MustDeclareVars", 1) AutoItSetOption("WinTitleMatchMode", 4) Const $BRANCO = 0xffffff Const $AZUL = 0x0000FF Const $FONTE = "Arial" Global $lbl Local $hGUI Local $WS_EX_TOPMOST Local $WS_POPUP HotKeySet("{ESC}", "Fechar") $hGUI = GUICreate("Hora", 185, 50, 6, -20, $WS_POPUP, $WS_EX_TOPMOST, 0) GUISetBkColor($AZUL, $hGUI) GUISetFont(15, -1, -1, $FONTE) $lbl = GUICtrlCreateLabel("00:00:00", 0, 0, 180) GUICtrlSetColor($lbl, $BRANCO) GUISetState(@SW_SHOWNOACTIVATE) While 1 Local $mostra_texto = "" $mostra_texto = "CLOCK: " & @HOUR & ":" & @MIN & ":" & @SEC GUICtrlSetData(-1, $mostra_texto) WinSetOnTop("Hora", "", 1) Sleep(900) WEnd Func Fechar() HotKeySet("{ESC}", "Fechar") Exit EndFunc Edited April 11, 2012 by Belini My Codes: Virtual Key Code UDF: http://www.autoitscript.com/forum/topic/138246-virtual-key-code-udf/ GuiSplashTextOn.au3: http://www.autoitscript.com/forum/topic/143542-guisplashtexton-udf/ Menu versions of Autoit: http://www.autoitscript.com/forum/topic/137435-menu-versions-of-autoit/#entry962011 Selects first folder of letters: ]http://www.autoitscript.com/forum/topic/144780-select-folders-by-letter/#entry1021708/spoiler] List files and folders with long addresses.: http://www.autoitscript.com/forum/topic/144910-list-files-and-folders-with-long-addresses/#entry102 2926 Program JUKEBOX made in Autoit:some functions:http://www.youtube.com/watch?v=WJ2tC2fD5Qs Navigation to search:http://www.youtube.com/watch?v=lblwOFIbgtQ 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