Jump to content



Photo

show clock


  • Please log in to reply
5 replies to this topic

#1 GtHoo

GtHoo

    Seeker

  • Active Members
  • 6 posts

Posted 11 April 2012 - 08:14 AM

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






#2 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 930 posts

Posted 11 April 2012 - 08:22 AM

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 by hannes08, 11 April 2012 - 08:31 AM.

Regards,Hannes
Spoiler

#3 GtHoo

GtHoo

    Seeker

  • Active Members
  • 6 posts

Posted 11 April 2012 - 08:55 AM

I did get a new problem. I can't see the whole time. Is it just me, er for you to?

Edited by GtHoo, 11 April 2012 - 09:05 AM.


#4 hannes08

hannes08

    my oh my

  • Active Members
  • PipPipPipPipPipPip
  • 930 posts

Posted 11 April 2012 - 09:09 AM

You'll have to set the width and height of your labels as well.
Regards,Hannes
Spoiler

#5 GtHoo

GtHoo

    Seeker

  • Active Members
  • 6 posts

Posted 11 April 2012 - 09:17 AM

It works. Tnx ;)

#6 Belini

Belini

    Polymath

  • Active Members
  • PipPipPipPip
  • 242 posts

Posted 11 April 2012 - 01:18 PM

Another option would be this:

Plain Text         
#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 by Belini, 11 April 2012 - 01:24 PM.

Posted ImageAutoit Forum Brazil: http://autoitbrasil.com/ >> Autoit and arcades: http://www.arcadebr.com/forumMy Codes:




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users