Jump to content
Sign in to follow this  
BrewManNH

Binary Coded Decimal (BCD) Clock

Recommended Posts

BrewManNH

Following along with the odd clock theme that seems to be popular lately, I have come up with a BCD clock to add to the collection. It's a 24 hour clock, you can modify it to a 12 hour clock, but it's not as interesting that way.

This clock can be changed to display milliseconds by changing one variable at the start of the Main function, there are comments describing that. In my opinion I wouldn't have it display the mseconds because they change too fast to keep track of, it looks terrible, and flickers BADLY.

The way the clock is set up currently, it displays one icon for the light being "off" and another for it being "on". You can use whatever icons for these that you'd like instead of the ones in the zip file. Change the variables in the Global declaration at the start of the script to whatever you'd like. Another variation that you can use is to set the "off" icon to a blank file name and then it will only turn on the lights that are supposed to be on, and there will be empty spaces for the off icons.

If nothing else, at least you'll learn binary and/or BCD numbers. :)

Updated: Corrected the issue with the seconds for the number 7.

 

BCD Clock.zip

Edited by BrewManNH
  • Like 1

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites
Chimp

funny clock

p.s.
it seems to me that there is an issue in the digit 7 of the seconds.

Here is a shorter way to turn on/off bits (Rearranging the GUICtrlCreateIcon positions on the GUI and within the array it can be shorten even much more)

;*****************************************
;BCD_Clock.au3 by BrewManNH
;*****************************************
#include <GUIConstantsEx.au3>

Global $aIcons[2] = [@ScriptDir & "\MyAutoIt3_Red.ico", @ScriptDir & "\MyAutoIt3_Green.ico"] ; [0] -> off , [1] -> on

Main()
Func Main()
    Local $GUIWidth = 470, $iNum_Columns = 5
;~     Note if you set this to true it will display the MS on the clock, but be warned it looks horrible and flickers badly
    Local $bShowMS = False ; False = No MS display, True = Display MS
    Local $aControlArray[21], $Counter = 0
    If $bShowMS Then
        $GUIWidth = 670
        $iNum_Columns = 8
        ReDim $aControlArray[32]
    EndIf
    $BCD_GUI = GUICreate("BCD Clock", $GUIWidth, 270, -1, -1)
    For $Column = 0 To $iNum_Columns
        For $Row = 3 To 0 Step -1
            If $Column = 0 And $Row < 2 Then ContinueLoop
            If $Column = 2 Or $Column = 4 And $Row < 1 Then ContinueLoop
            $aControlArray[$Counter] = GUICtrlCreateIcon($aIcons[0], -1, ($Column * 70) + 30, ($Row * 55) + 25, 48, 48, -1, -1)
            $Counter += 1
        Next
    Next
    GUICtrlCreateLabel(" Hours ", 70, 250)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel(" Minutes ", 200, 250)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel(" Seconds ", 340, 250)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel(" ms ", 530, 250)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel("8", 10, 35)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel("4", 10, 90)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel("2", 10, 150)
    GUICtrlSetFont(-1, 8.5, 600)
    GUICtrlCreateLabel("1", 10, 210)
    GUICtrlSetFont(-1, 8.5, 600)
    GUISetState()
    While 1
        $iMsg = GUIGetMsg()
        Switch $iMsg
            Case $GUI_EVENT_CLOSE
                Exit
        EndSwitch
        _SetHour(@HOUR, $aControlArray)
        _Set10sMin(@MIN, $aControlArray)
        _Set10sSec(@SEC, $aControlArray)
        If $bShowMS Then _Set100sMSec(@MSEC, $aControlArray)
    WEnd
EndFunc   ;==>Main
Func _SetHour($Hour, $aArray)
    Local Static $LastHour
    If $Hour = $LastHour Then Return
    $LastHour = $Hour
    Local $sBCD = _Dec_To_Binary(Int($Hour / 10), 2) & _Dec_To_Binary(StringRight($Hour, 1), 4)
    GUICtrlSetImage($aArray[0], $aIcons[StringMid($sBCD, 2, 1)])
    GUICtrlSetImage($aArray[1], $aIcons[StringMid($sBCD, 1, 1)])
    GUICtrlSetImage($aArray[2], $aIcons[StringMid($sBCD, 6, 1)])
    GUICtrlSetImage($aArray[3], $aIcons[StringMid($sBCD, 5, 1)])
    GUICtrlSetImage($aArray[4], $aIcons[StringMid($sBCD, 4, 1)])
    GUICtrlSetImage($aArray[5], $aIcons[StringMid($sBCD, 3, 1)])
EndFunc   ;==>_SetHour
Func _Set10sMin($iMin, $aArray)
    Local Static $LastMin
    If $iMin = $LastMin Then Return
    $LastMin = $iMin
    Local $sBCD = _Dec_To_Binary(Int($iMin / 10), 3) & _Dec_To_Binary(StringRight($iMin, 1), 4)
    GUICtrlSetImage($aArray[6], $aIcons[StringMid($sBCD, 3, 1)])
    GUICtrlSetImage($aArray[7], $aIcons[StringMid($sBCD, 2, 1)])
    GUICtrlSetImage($aArray[8], $aIcons[StringMid($sBCD, 1, 1)])
    GUICtrlSetImage($aArray[9], $aIcons[StringMid($sBCD, 7, 1)])
    GUICtrlSetImage($aArray[10], $aIcons[StringMid($sBCD, 6, 1)])
    GUICtrlSetImage($aArray[11], $aIcons[StringMid($sBCD, 5, 1)])
    GUICtrlSetImage($aArray[12], $aIcons[StringMid($sBCD, 4, 1)])
EndFunc   ;==>_Set10sMin
Func _Set10sSec($iSec, $aArray)
    Local Static $LastSec
    If $iSec = $LastSec Then Return
    $LastSec = $iSec
    Local $sBCD = _Dec_To_Binary(Int($iSec / 10), 3) & _Dec_To_Binary(StringRight($iSec, 1), 4)
    GUICtrlSetImage($aArray[13], $aIcons[StringMid($sBCD, 3, 1)])
    GUICtrlSetImage($aArray[14], $aIcons[StringMid($sBCD, 2, 1)])
    GUICtrlSetImage($aArray[15], $aIcons[StringMid($sBCD, 1, 1)])
    GUICtrlSetImage($aArray[16], $aIcons[StringMid($sBCD, 7, 1)])
    GUICtrlSetImage($aArray[17], $aIcons[StringMid($sBCD, 6, 1)])
    GUICtrlSetImage($aArray[18], $aIcons[StringMid($sBCD, 5, 1)])
    GUICtrlSetImage($aArray[19], $aIcons[StringMid($sBCD, 4, 1)])
EndFunc   ;==>_Set10sSec

Func _Set100sMSec($iMSec, $aArray)
    Local Static $LastMSec
    If $iMSec = $LastMSec Then Return
    $LastMSec = $iMSec
    Local $iMilli = StringFormat('%03i', $iMSec)
    Local $sBCD = _Dec_To_Binary(StringMid($iMilli, 1, 1), 4) & _Dec_To_Binary(StringMid($iMilli, 2, 1), 4) & _Dec_To_Binary(StringMid($iMilli, 3, 1), 4)
    GUICtrlSetImage($aArray[20], $aIcons[StringMid($sBCD, 4, 1)])
    GUICtrlSetImage($aArray[21], $aIcons[StringMid($sBCD, 3, 1)])
    GUICtrlSetImage($aArray[22], $aIcons[StringMid($sBCD, 2, 1)])
    GUICtrlSetImage($aArray[23], $aIcons[StringMid($sBCD, 1, 1)])
    GUICtrlSetImage($aArray[24], $aIcons[StringMid($sBCD, 8, 1)])
    GUICtrlSetImage($aArray[25], $aIcons[StringMid($sBCD, 7, 1)])
    GUICtrlSetImage($aArray[26], $aIcons[StringMid($sBCD, 6, 1)])
    GUICtrlSetImage($aArray[27], $aIcons[StringMid($sBCD, 5, 1)])
    GUICtrlSetImage($aArray[28], $aIcons[StringMid($sBCD, 12, 1)])
    GUICtrlSetImage($aArray[29], $aIcons[StringMid($sBCD, 11, 1)])
    GUICtrlSetImage($aArray[30], $aIcons[StringMid($sBCD, 10, 1)])
    GUICtrlSetImage($aArray[31], $aIcons[StringMid($sBCD, 9, 1)])
EndFunc   ;==>_Set100sMSec

Func _Dec_To_Binary($iNumber, $iBits) ; from decimal to binary
    ; http://www.autoitscript.com/forum/topic/90056-decimal-to-binary-number-converter/?p=647505
    Local $sBinString = ""
    While $iNumber
        $sBinString = BitAND($iNumber, 1) & $sBinString
        $iNumber = BitShift($iNumber, 1)
    WEnd
    Return StringFormat('%0' & $iBits & 'i', $sBinString)
EndFunc   ;==>_Dec_To_Binary

 

hope that some others funny clocks will appear on the forum

Edited by Chimp

small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

Share this post


Link to post
Share on other sites
BrewManNH

I fixed the issue with the original script to correct the bug with the number 7 in the seconds.

Here is a shorter way to turn on/off bits (Rearranging the GUICtrlCreateIcon positions on the GUI and within the array it can be shorten even much more)

 Nice update to the display method. Not as easy to read but definitely a good approach I wouldn't have thought of. :)


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Similar Content

    • UEZ
      By UEZ
      Nothing special - just another analogue clock.  -> Read https://en.wikipedia.org/wiki/Swiss_railway_clock for more information.

       
      Requires Windows7+ OS!
      ;the Hilfiker / MobaTime Swiss Railway Clock ;coded by UEZ build 2018-03-01 ;thanks to Eukalyptus for the _CreateBrushedAluminum() function! #Pragma Compile(Icon, "GDI+ Swiss Railway Clock.ico") #AutoIt3Wrapper_Run_Au3Stripper=y #Au3Stripper_Parameters=/so /pe /rm #AutoIt3Wrapper_Run_After=del /f /q "%scriptdir%\%scriptfile%_stripped.au3" #AutoIt3Wrapper_UseX64=n Break(0) #include <GDIPlus.au3> #include <GuiConstantsEx.au3> #include <WindowsConstants.au3> ProcessSetPriority(@AutoItPID, $PROCESS_LOW) _GDIPlus_Startup() Global $hGUI, $iFPS = 0, $iShowFPS = 0, $bExit Global Const $iW = 512, $iH = $iW, $iWh = $iW / 2, $iHh = $iH / 2, $sTitle = "GDI+ Swiss Railway Clock v1.1" Global Const $fRad = ACos(-1) / 180, $fDeg = 180 / ACos(-1), $iTimer = 30, $fDeltaShadow = $iW * 0.020 Global $hDC, $hCanvas, $hBitmap_Clock, $hBrush_Shadow, $hBrush_Update, $hPen_Update, $fDiameter = $iW, $hDC_backbuffer, $fShadowAngle, $fMin_next, _ $fRadius = $fDiameter / 2, $fSec, $fMin, $fHr, $fAmplitude = 3 AutoItSetOption("GUIOnEventMode", 1) GDIPlus_SwissRailwayClock() AutoItSetOption("GUIOnEventMode", 0) _GDIPlus_Shutdown() Func GDIPlus_SwissRailwayClock() $bExit = False $hGUI = GUICreate($sTitle, $iW + $fDeltaShadow, $iH + $fDeltaShadow, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0xFFFFFF, $hGUI) GUISetState(@SW_SHOW, $hGUI) ;~ GUISetCursor(16, 1) ;create canvas elements $hDC = _WinAPI_GetDC($hGUI) Local Const $hHBitmap = _WinAPI_CreateCompatibleBitmap($hDC, $iW + $fDeltaShadow, $iH + $fDeltaShadow) $hDC_backbuffer = _WinAPI_CreateCompatibleDC($hDC) Local Const $DC_obj = _WinAPI_SelectObject($hDC_backbuffer, $hHBitmap) $hCanvas = _GDIPlus_GraphicsCreateFromHDC($hDC_backbuffer) $hBrush_Shadow = _GDIPlus_BrushCreateSolid(0x14A0A0A0) $hPen_Update = _GDIPlus_PenCreate(0xFFA02020) $hBrush_Update = _GDIPlus_BrushCreateSolid(0) _GDIPlus_GraphicsSetSmoothingMode($hCanvas, $GDIP_SMOOTHINGMODE_HIGHQUALITY) _GDIPlus_GraphicsSetPixelOffsetMode($hCanvas, $GDIP_PIXELOFFSETMODE_HIGHQUALITY) $fDiameter = $fDiameter < 128 ? 128 : $fDiameter > 1024 ? 1024 : $fDiameter $hBitmap_Clock = GenerateClockBg($fDiameter) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit_About") $fMin_next = @MIN GUIRegisterMsg($WM_TIMER, "Draw") ;$WM_TIMER = 0x0113 Local $iID = DllCall("User32.dll", "uint_ptr", "SetTimer", "hwnd", $hGUI, "uint_ptr", 1, "uint", $iTimer, "ptr", 0)[0] Do If $bExit Then ExitLoop Until Not Sleep(100) ;release resources GUIRegisterMsg($WM_TIMER, "") DllCall("user32.dll", "bool", "KillTimer", "hwnd", $hGUI, "uint_ptr", $iID) _GDIPlus_PenDispose($hPen_Update) _GDIPlus_BrushDispose($hBrush_Shadow) _GDIPlus_BrushDispose($hBrush_Update) _GDIPlus_GraphicsDispose($hCanvas) _WinAPI_SelectObject($hDC_backbuffer, $DC_obj) _WinAPI_DeleteDC($hDC_backbuffer) _WinAPI_DeleteObject($hHBitmap) _WinAPI_ReleaseDC($hGUI, $hDC) GUIDelete($hGUI) EndFunc ;==>GDIPlus_SwissRailwayClock Func Draw($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg, $wParam, $lParam _GDIPlus_GraphicsDrawImageRect($hCanvas, $hBitmap_Clock, 0, 0, $fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow) UpdateClock($hCanvas, $fDiameter) _WinAPI_BitBlt($hDC, 0, 0, $iW + $fDeltaShadow, $iH + $fDeltaShadow, $hDC_backbuffer, 0, 0, $SRCCOPY) EndFunc Func _Exit_About() $bExit = True EndFunc ;==>_Exit_About Func UpdateClock($hGfx, $fDiameter) Static $bBounce = 0, $f = 0 Local $m1 = $fDiameter * 0.015 ;hour $fHr = 30 * (@HOUR + @MIN / 60) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fHr) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.0375, _ $iHeight1 = $fDiameter / 2.5, _ $iWidth12 = $iWidth1 / 2, _ $fPosY = $fDiameter * 0.2, $iWidth2, $iWidth22, $fPosY2 _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFF101010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fHr) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;min If $fMin_next <> @MIN Then $bBounce = 1 Switch $bBounce Case 1 $fMin = (6 * Mod(($fMin_next + 1), 60)) + Sin($f * 1.9) * $fAmplitude If $fAmplitude = 0 Then $fMin_next = @MIN $f = 0 $fAmplitude = 3 $bBounce = 0 Else $fAmplitude -= 0.5 $fAmplitude = $fAmplitude <= 0 ? 0 : $fAmplitude $f += 1 EndIf Case Else $fMin = (6 * @MIN) EndSwitch _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fMin) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $iWidth1 = $fDiameter * 0.03 $iHeight1 = $fRadius $iWidth12 = $iWidth1 / 2 $fPosY = $fDiameter * 0.1 DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth12 + Cos(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fMin) * $fRad) * $m1, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) _GDIPlus_GraphicsResetTransform($hGfx) ;sec $fSec = 6 * (@SEC * 1.02564 + @MSEC / 1000) If $fSec >= 360 Then $fSec = 0 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, $fSec) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) $fPosY = $fDiameter * 0.27 $fPosY2 = $fDiameter * 0.19 $iWidth1 = $fDiameter * 0.0095 $iHeight1 = $fRadius * 1.3 - $fPosY $iWidth12 = $iWidth1 / 2 $iWidth2 = $fDiameter * 0.083333 $iWidth22 = $iWidth2 / 2 ;shadow seconds DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth1 + $fDiameter * 0.006667, "float", $iHeight1 + $fDiameter * 0.006667) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Shadow, _ "float", $fRadius - $iWidth22 + Cos(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $fPosY2 + Sin(($fShadowAngle - $fSec) * $fRad) * $m1, _ "float", $iWidth2, "float", $iWidth2) ;seconds _GDIPlus_BrushSetSolidColor($hBrush_Update, 0xFFC01010) DllCall($__g_hGDIPDll, "int", "GdipFillRectangle", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth12, _ "float", $fPosY, _ "float", $iWidth1, "float", $iHeight1) DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth22, _ "float", $fPosY2, _ "float", $iWidth2, "float", $iWidth2) _GDIPlus_GraphicsResetTransform($hGfx) ;button in the center DllCall($__g_hGDIPDll, "int", "GdipFillEllipse", "handle", $hGfx, "handle", $hBrush_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) DllCall($__g_hGDIPDll, "int", "GdipDrawEllipse", "handle", $hGfx, "handle", $hPen_Update, _ "float", $fRadius - $iWidth1, _ "float", $fRadius - $iWidth1, _ "float", 2 * $iWidth1, "float", 2 * $iWidth1) EndFunc Func GenerateClockBg($fDiameter) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($fDiameter + $fDeltaShadow, $fDiameter + $fDeltaShadow), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap), _ $hBrush = _GDIPlus_BrushCreateSolid(0xFF000000), $fBorderSize = $fDiameter * 0.03333, _ $hEffect = _GDIPlus_EffectCreateBlur($fDiameter / 50, 0), $hPen = _GDIPlus_PenCreate(0xA0000000, $fBorderSize) _GDIPlus_GraphicsSetSmoothingMode($hGfx, 4) _GDIPlus_GraphicsSetPixelOffsetMode($hGfx, 4) _GDIPlus_GraphicsSetTextRenderingHint($hGfx, 4) _GDIPlus_GraphicsClear($hGfx, 0xFFFFFFFF) Local Const $fSize = $fDiameter * 0.95 - $fBorderSize / 2 Local $fShadow_vx = $fDiameter * 0.0095, $fShadow_vy = $fDiameter * 0.01 $fShadowAngle = ATan($fShadow_vy / $fShadow_vx) * $fDeg If $fShadow_vx < 0 And $fShadow_vy >= 0 Then $fShadowAngle += 180 If $fShadow_vx < 0 And $fShadow_vy < 0 Then $fShadowAngle -= 180 _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize + $fShadow_vx, $fBorderSize + $fShadow_vy, $fSize, $fSize, $hPen) _GDIPlus_BitmapApplyEffect($hBitmap, $hEffect) _GDIPlus_PenSetColor($hPen, 0xF0000000) Local Const $hBitmap_Texture = _CreateBrushedAluminum($fDiameter, $fDiameter, $fShadowAngle) Local Const $hTexture = _GDIPlus_TextureCreate($hBitmap_Texture) DllCall($__g_hGDIPDll, "int", "GdipSetPenBrushFill", "ptr", $hPen, "ptr", $hTexture) _GDIPlus_GraphicsDrawEllipse($hGfx, $fBorderSize, $fBorderSize, $fSize, $fSize, $hPen) _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, -6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Local $iWidth1 = $fDiameter * 0.026667, $iHeight1 = $fDiameter / 10, $iWidth12 = $iWidth1 / 2, $fPosY = $fDiameter * 0.083333, _ $iWidth2 = $fDiameter * 0.013333, $iHeight2 = $fDiameter * 0.0416667, $iWidth22 = $iWidth2 / 2 For $i = 0 to 59 _GDIPlus_GraphicsTranslateTransform($hGfx, $fRadius, $fRadius) _GDIPlus_GraphicsRotateTransform($hGfx, 6) _GDIPlus_GraphicsTranslateTransform($hGfx, -$fRadius, -$fRadius) Switch Mod($i, 5) Case 0 _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth12, $fPosY, $iWidth1, $iHeight1, $hBrush) Case Else _GDIPlus_GraphicsFillRect($hGfx, $fRadius - $iWidth22, $fPosY, $iWidth2, $iHeight2, $hBrush) EndSwitch Next _GDIPlus_GraphicsResetTransform($hGfx) Local Const $hBitmap_Logo = _GDIPlus_BitmapCreateFromMemory(_Au3_Icon()) Local Const $hBitmap_Logo_Scaled = _GDIPlus_ImageResize($hBitmap_Logo, $fDiameter * 0.08, $fDiameter * 0.08) Local $aDim = _GDIPlus_ImageGetDimension($hBitmap_Logo_Scaled) _GDIPlus_GraphicsDrawImageRect($hGfx, $hBitmap_Logo_Scaled, $fRadius - $aDim[0] / 2, $fRadius / 1.75, $aDim[0], $aDim[1]) _GDIPlus_ImageDispose($hBitmap_Logo) _GDIPlus_ImageDispose($hBitmap_Logo_Scaled) Local Const $hFamily = _GDIPlus_FontFamilyCreate("Segoe Script"), $hFont = _GDIPlus_FontCreate($hFamily, $fDiameter * 0.025), $hFormat = _GDIPlus_StringFormatCreate() _GDIPlus_StringFormatSetAlign($hFormat, 1) _GDIPlus_StringFormatSetLineAlign($hFormat, 1) ;~ _GDIPlus_BrushSetSolidColor($hBrush, 0xFF400000) _GDIPlus_GraphicsDrawStringEx($hGfx, "Clock by" & @CRLF & "UEZ", $hFont, _GDIPlus_RectFCreate($fRadius - $fRadius * 0.2, $fRadius + $fRadius * 0.2, $fRadius * 0.4, $fRadius * 0.4), $hFormat, $hBrush) _GDIPlus_ImageDispose($hBitmap_Texture) _GDIPlus_BrushDispose($hTexture) _GDIPlus_FontDispose($hFont) _GDIPlus_FontFamilyDispose($hFamily) _GDIPlus_StringFormatDispose($hFormat) _GDIPlus_EffectDispose($hEffect) _GDIPlus_PenDispose($hPen) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx) Return $hBitmap EndFunc Func _CreateBrushedAluminum($iW, $iH, $fLightAngle = 40, $iBlurDist = 12, $fBlurTrans = 0.6666, $fRed = 0.8, $fGreen = 0.9, $fBlue = 1, $iLightColor = 0xF0FFFFFF, $fLightSigma = 0.5, $fLightScale = 0.83) ;coded by Eukalyptus! $iBlurDist = Ceiling($iBlurDist) $iBlurDist += 1 - Mod($iBlurDist, 2) Local $iOverSize = 0 For $i = 1 To $iBlurDist Step 2 $iOverSize += $i + $i + 1 Next Local $iWO = $iW + $iOverSize ;========================================= ; Add Noise ;========================================= Local $iNoiseSize = 40 Local $hBmp_Noise = _GDIPlus_BitmapCreateFromScan0($iNoiseSize, $iNoiseSize) Local $hGfx_Noise = _GDIPlus_ImageGetGraphicsContext($hBmp_Noise) Local $tData = _GDIPlus_BitmapLockBits($hBmp_Noise, 0, 0, $iNoiseSize, $iNoiseSize, BitOR($GDIP_ILMREAD, $GDIP_ILMWRITE), $GDIP_PXF32ARGB) Local $iStride = DllStructGetData($tData, "Stride") Local $iWidth = DllStructGetData($tData, "Width") Local $iHeight = DllStructGetData($tData, "Height") Local $pScan0 = DllStructGetData($tData, "Scan0") Local $tPixel = DllStructCreate("dword[" & $iWidth * $iHeight & "];", $pScan0) Local $iAmp For $row = 0 To $iHeight - 1 For $col = 0 To $iWidth - 1 $iAmp = Random(0, 0xFF, 1) DllStructSetData($tPixel, 1, BitOR(0xFF000000, BitShift($iAmp, -16), BitShift($iAmp, -8), $iAmp), $row * $iWidth + $col + 1) Next Next _GDIPlus_BitmapUnlockBits($hBmp_Noise, $tData) ;========================================= ; Create Full NoiseBitmap ;========================================= Local $hBmp_Full = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full = _GDIPlus_ImageGetGraphicsContext($hBmp_Full) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $iXOff, $iYOff, $iSizeX, $iSizeY For $y = 0 To $iH Step $iNoiseSize / 2 For $x = 0 To $iWO Step $iNoiseSize / 2 $iXOff = Random(0, $iNoiseSize / 2, 1) $iYOff = Random(0, $iNoiseSize / 2, 1) $iSizeX = $iNoiseSize - $iXOff $iSizeY = $iNoiseSize - $iYOff _GDIPlus_GraphicsDrawImageRectRect($hGfx_Full, $hBmp_Noise, $iXOff, $iYOff, $iSizeX, $iSizeY, $x, $y, $iSizeX, $iSizeY) Next Next _GDIPlus_GraphicsDispose($hGfx_Noise) _GDIPlus_BitmapDispose($hBmp_Noise) ;========================================= ; MotionBlur ;========================================= Local $hBmp_Full2 = _GDIPlus_BitmapCreateFromScan0($iWO, $iH) Local $hGfx_Full2 = _GDIPlus_ImageGetGraphicsContext($hBmp_Full2) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Full2, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) Local $tColorMatrix = DllStructCreate("float[5]; float[5]; float[5]; float[5]; float[5];") DllStructSetData($tColorMatrix, 1, 1, 1) DllStructSetData($tColorMatrix, 2, 1, 2) DllStructSetData($tColorMatrix, 3, 1, 3) DllStructSetData($tColorMatrix, 4, $fBlurTrans, 4) DllStructSetData($tColorMatrix, 5, 1, 5) Local $hImgAttrib = _GDIPlus_ImageAttributesCreate() DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) For $i = 1 To $iBlurDist Step 2 DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full2, "ptr", $hBmp_Full, _ "float", $i, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) If $i >= $iBlurDist Then DllStructSetData($tColorMatrix, 1, $fRed, 1) DllStructSetData($tColorMatrix, 2, $fGreen, 2) DllStructSetData($tColorMatrix, 3, $fBlue, 3) DllStructSetData($tColorMatrix, 4, 1, 4) DllCall($__g_hGDIPDll, "int", "GdipSetImageAttributesColorMatrix", "ptr", $hImgAttrib, "int", 1, "int", 1, "struct*", $tColorMatrix, "struct*", 0, "int", 0) EndIf DllCall($__g_hGDIPDll, "int", "GdipDrawImageRectRect", "ptr", $hGfx_Full, "ptr", $hBmp_Full2, _ "float", $i + 1, "float", 0, "float", $iWO, "float", $iH, _ "float", 0, "float", 0, "float", $iWO, "float", $iH, _ "int", 2, "ptr", $hImgAttrib, "ptr", 0, "ptr", 0) Next _GDIPlus_ImageAttributesDispose($hImgAttrib) _GDIPlus_GraphicsDispose($hGfx_Full2) _GDIPlus_BitmapDispose($hBmp_Full2) _GDIPlus_GraphicsDispose($hGfx_Full) ;========================================= ; Add Light ;========================================= Local $hBmp_Alu = _GDIPlus_BitmapCreateFromScan0($iW, $iH) Local $hGfx_Alu = _GDIPlus_ImageGetGraphicsContext($hBmp_Alu) _GDIPlus_GraphicsSetSmoothingMode($hGfx_Alu, 4) _GDIPlus_GraphicsSetInterpolationMode($hGfx_Full, 3) _GDIPlus_GraphicsDrawImage($hGfx_Alu, $hBmp_Full, -$iOverSize, 0) _GDIPlus_BitmapDispose($hBmp_Full) Local $tPointF1 = DllStructCreate("float; float;") Local $tPointF2 = DllStructCreate("float; float;") DllStructSetData($tPointF2, 2, $iH * $fLightScale) $aResult = DllCall($__g_hGDIPDll, "int", "GdipCreateLineBrush", "struct*", $tPointF1, "struct*", $tPointF2, "uint", 0, "uint", $iLightColor, "int", 0, "handle*", 0) If @error Or Not IsArray($aResult) Then Return SetError(1, 4, False) Local $hBrush = $aResult[6] _GDIPlus_LineBrushSetSigmaBlend($hBrush, $fLightSigma) _GDIPlus_LineBrushSetGammaCorrection($hBrush) DllCall($__g_hGDIPDll, "int", "GdipRotateLineTransform", "ptr", $hBrush, "float", $fLightAngle, "int", 0) _GDIPlus_GraphicsFillRect($hGfx_Alu, 0, 0, $iW, $iH, $hBrush) _GDIPlus_BrushDispose($hBrush) _GDIPlus_GraphicsDispose($hGfx_Alu) Return $hBmp_Alu EndFunc ;==>_CreateBrushedAluminum ;Code below was generated by: 'File to Base64 String' Code Generator v1.20 Build 2018-02-02 Func _Au3_Icon($bSaveBinary = False, $sSavePath = @ScriptDir) Local $Au3_Icon $Au3_Icon &= 'iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAP0ElEQVR4XtWZW4hs6VXHf+v79qWquruquqtvZ/r0uc8540yScTIQQ0JkDOYyGhIkhhAxxhdR8mDAgAg+6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64Decode($Au3_Icon) If @error Then Return SetError(1, 0, 0) $bString = Binary($bString) If $bSaveBinary Then Local Const $hFile = FileOpen($sSavePath & "\au3-icon2.png", 18) If @error Then Return SetError(2, 0, $bString) FileWrite($hFile, $bString) FileClose($hFile) EndIf Return $bString EndFunc ;==>_Au3_Icon Func _WinAPI_Base64Decode($sB64String) Local $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "ptr", 0, "dword*", 0, "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(1, 0, "") Local $bBuffer = DllStructCreate("byte[" & $aCrypt[5] & "]") $aCrypt = DllCall("Crypt32.dll", "bool", "CryptStringToBinaryA", "str", $sB64String, "dword", 0, "dword", 1, "struct*", $bBuffer, "dword*", $aCrypt[5], "ptr", 0, "ptr", 0) If @error Or Not $aCrypt[0] Then Return SetError(2, 0, "") Return DllStructGetData($bBuffer, 1) EndFunc ;==>_WinAPI_Base64Decode  
      If you want to run in x64 mode please use AutoIt version 3.3.14.3 since the bug in function _GDIPlus_EffectCreate() has been fixed!
       
      For the widget style clock see here:
       
    • golfinhu
      By golfinhu
      Hi, ppl.

      I am developing a GUI with a fix sidebar, based on the style of windows 10 ... I have 3 problems at the moment.
      1 - How do I put the close and minimize buttons on my window? (I want my window not to have the top bar). I tried to draw with gdi plus but I could not.
      2 - My watch flashes when the time is updated. I tried to do with _GDIPlus_GraphicsDrawString but the strings get overlapped.
      3 - I can not leave my transparent buttons to put them in the sidebar (as in this photo below)

      If anyone can help me I would appreciate it very much.
      thanks a lot
       
      GUI.au3
    • Chimp
      By Chimp
      Just for fun
      Idea from here:
      http://codegolf.stackexchange.com/questions/73259/output-the-current-time-in-ascii-art
      Edit:
      Also added an analogue experimental version in post #11
      #include <GUIConstants.au3> HotKeySet("{ESC}", "End") Local $hClock, $sDelim = ";", $aChar, $sScanLines, $aScanLine[6], $aFont[13] = [ _ ' ___ ; / _ \ ; | | | | ; | | | | ; | |_| | ; \___/ ', _ ; 0 ' __ ; /_ | ; | | ; | | ; | | ; |_| ', _ ; 1 ' ___ ; |__ \ ; ) | ; / / ; / /_ ; |____| ', _ ; 2 ' ____ ; |___ \ ; __) | ; |__ < ; ___) | ; |____/ ', _ ; 3 ' _ _ ; | || | ; | || |_ ; |__ _| ; | | ; |_| ', _ ; 4 ' _____ ; | ____| ; | |__ ; |___ \ ; ___) | ; |____/ ', _ ; 5 ' __ ; / / ; / /_ ; | _ \ ; | (_) | ; \___/ ', _ ; 6 ' ______ ; |____ | ; / / ; / / ; / / ; /_/ ', _ ; 7 ' ___ ; / _ \ ; | (_) | ; > _ < ; | (_) | ; \___/ ', _ ; 8 ' ___ ; / _ \ ; | (_) | ; \__, | ; / / ; /_/ ', _ ; 9 ' ; _ ;(_); _ ;(_); ', _ ; : " ; ; __ _ _ __ ;/ _` | ' \;\__,_|_|_|_|; ", _ ; am " ; ; _ __ _ __ ;| '_ \ ' \;| .__/_|_|_|;|_|"]; pm Global $hAsciiClock = GUICreate("Ascii clock", 390, 80, 10, 10, $WS_POPUPWINDOW, BitOR($WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_COMPOSITED)) $hClock = GUICtrlCreateLabel("", 0, 0, 390, 80, -1, $GUI_WS_EX_PARENTDRAG) GUICtrlSetFont(-1, 7, 0, 0, "Courier new") GUISetState() While 1 $sTime = StringFormat("%02s", @HOUR - (12 * (@HOUR > 12))) & "A" & @MIN & "A" & @SEC & Hex(11 + Number(@HOUR > 12), 1) For $x = 1 To StringLen($sTime) $achar = StringSplit($aFont[Dec(StringMid($sTime, $x, 1))], $sDelim, 3) For $i = 0 To 5 If $x = StringLen($sTime) Then ; last char (am or pm) $aScanLine[$i] = StringFormat('%-65s', $aScanLine[$i]) & $achar[$i] Else $aScanLine[$i] &= $achar[$i] EndIf Next Next For $i = 0 To 5 $sScanLines &= $aScanLine[$i] & @CRLF $aScanLine[$i] = "" Next GUICtrlSetData($hClock, $sScanLines) $sScanLines = "" Sleep(1000) WEnd Func End() If WinActive("[ACTIVE]") = $hAsciiClock Then Exit EndFunc ;==>End  
    • UEZ
      By UEZ
      Here my contribution to the clock fever - nothing special rather a fast hack:
      Download:  AutoIt Eye Clock v1.3.1 build 2015-06-28.7z
       
      Left eye = hour, right eye = minutes, pupil light = seconds

       
       
       
       
       


       
      You can rename the compiled script to *.scr to behave as an screensaver. Furthermore you can copy the *.scr to System32 (x86 system) or SysWOW64 (x64 system) and configure it as a screensaver incl. preview.
       
      Original clock: http://www.suck.uk.com/products/eyeclock/
       
      Have fun.
    • Melba23
      By Melba23
      The Fibonacci clock lets you know the time by changing colours and requiring you do some adding up.

      The Fibonacci sequence is the sequence beginning 1, 1 and where each number is the sum of the previous two. Its first five digits are: 1, 1, 2, 3, 5.  These numbers are all you need to express all the numbers from 1 to 12.
      1 = 1
      1+1 = 2
      ...
      1 + 1 + 2 + 3 + 5 = 12
      which means that it is possible to use them to describe the twelve positions on a clock, and therefore tell the time in 5 minute intervals.
      Philippe Chrétien of Montreal Canada made such a clock with squares of side length 1, 1, 2, 3, and 5 (the numbers in the Fibonacci sequence) arranged into a "golden rectangle".  The squares lit up in red tell you the hour, and in green give you the minutes (in multiples of five). A square lit up in blue meant it is to be added for both hour and minute. Transparent squares are ignored.

      The first example below decodes as follows:
      Hours, red 5, red 1 and blue 3 = 5 + 1 + 3 = 9 hours
      Minutes: green 2 and blue 3 = 2 + 3 = 5.  5 x 5 = 25 minutes.
      So, the time is 9.25.

      And here is a little script to show how you can create a Fibonacci clock of your own - by default it shows the current time (which you can reset at any time using the "Reset" button) or you can test it by entering a time in the combos:
      #include <GUIConstantsEx.au3> #include <MsgBoxConstants.au3> #include <Date.au3> $iMargin_X = 10 $iMargin_Y = 10 $iMargin_Inter = 5 $iSize = 50 $iButton_Level = ($iSize * 5) + $iMargin_Inter + 20 $hGUI = GUICreate("Fibonacci Clock", ($iSize * 8) + ($iMargin_X * 2), $iButton_Level + 100) GUISetBkColor(0xC4C4C4) $cBack = GUICtrlCreateLabel("", $iMargin_X - $iMargin_Inter, $iMargin_Y - $iMargin_Inter, _ ($iSize * 8) + ($iMargin_Inter * 2), ($iSize * 5) + $iMargin_Inter) GUICtrlSetBkColor($cBack, 0x000000) $cLabel_1A = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_1B = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 2), $iMargin_Y + $iSize, $iSize - $iMargin_Inter, $iSize - $iMargin_Inter) $cLabel_2 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y, ($iSize * 2) - $iMargin_Inter, ($iSize * 2) - $iMargin_Inter) $cLabel_3 = GUICtrlCreateLabel("", $iMargin_X, $iMargin_Y + ($iSize * 2), ($iSize * 3) - $iMargin_Inter, ($iSize * 3) - $iMargin_Inter) $cLabel_5 = GUICtrlCreateLabel("", $iMargin_X + ($iSize * 3), $iMargin_Y, $iSize * 5, ($iSize * 5) - $iMargin_Inter) $cUserSet = GUICtrlCreateButton("Set User Time", $iMargin_X, $iButton_Level, 100, 30) $cUserHour = GUICtrlCreateCombo("", $iMargin_X + 120, $iButton_Level, 40, 20) GUICtrlSetData($cUserHour, "00|01|02|03|04|05|06|07|08|09|10|11|12") $cUserMin = GUICtrlCreateCombo("", $iMargin_X + 160, $iButton_Level, 40, 20) GUICtrlSetData($cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55") $cReset = GUICtrlCreateButton("Reset Current Time", $iMargin_X, $iButton_Level + 50, 120, 30) GUICtrlCreateLabel("Hours:" & @CRLF & @CRLF & "Mins:" & @CRLF & @CRLF & "Both:", 250, $iButton_Level, 150, 80) GUICtrlCreateLabel("", 300, $iButton_Level, 50, 20) GUICtrlSetBkColor(-1, 0xFF0000) GUICtrlCreateLabel("", 300, $iButton_Level + 25, 50, 20) GUICtrlSetBkColor(-1, 0x00FF00) GUICtrlCreateLabel("", 300, $iButton_Level + 50, 50, 20) GUICtrlSetBkColor(-1, 0x0000FF) GUISetState() _Reset() While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $cReset _Reset() Case $cUserSet $iHour = GUICtrlRead($cUserHour) $iMin = GUICtrlRead($cUserMin) / 5 _Set_Clock($iHour, $iMin) EndSwitch WEnd Func _Reset() $sDTG = _NowCalc() $iHour = StringRegExpReplace($sDTG, "^.*\s(\d\d):.*", "$1") $iHour = (($iHour > 12) ? ($iHour - 12) : ($iHour)) $iMin = Int(StringRegExpReplace($sDTG, "^.*:(\d\d):.*", "$1") / 5) _Set_Clock($iHour, $iMin) EndFunc ;==>_Reset Func _Set_Clock($iH, $iM) $iH = Number($iH) $iM = Number($iM) ;ConsoleWrite("Entry: " & $iH & " - " & $iM & @CRLF) GUICtrlSetBkColor($cLabel_1A, 0xC4C4C4) GUICtrlSetBkColor($cLabel_1B, 0xC4C4C4) GUICtrlSetBkColor($cLabel_2, 0xC4C4C4) GUICtrlSetBkColor($cLabel_3, 0xC4C4C4) GUICtrlSetBkColor($cLabel_5, 0xC4C4C4) $iState_1A = 0 $iState_1B = 0 $iState_2 = 0 $iState_3 = 0 $iState_5 = 0 While $iH ;ConsoleWrite($iH & @CRLF) Switch $iH Case 5 To 12 ;;ConsoleWrite("5-12" & @CRLF) If Not $iState_5 Then ;;ConsoleWrite("- 5" & @CRLF) $iH -= 5 GUICtrlSetBkColor($cLabel_5, 0XFF0000) $iState_5 = 1 Else ContinueCase EndIf Case 3 To 12 ;;ConsoleWrite("3-12" & @CRLF) If Not $iState_3 Then ;;ConsoleWrite("- 3" & @CRLF) $iH -= 3 GUICtrlSetBkColor($cLabel_3, 0XFF0000) $iState_3 = 1 Else ContinueCase EndIf Case 2 To 12 ;;ConsoleWrite("2-12" & @CRLF) If Not $iState_2 Then ;;ConsoleWrite("- 2" & @CRLF) $iH -= 2 GUICtrlSetBkColor($cLabel_2, 0XFF0000) $iState_2 = 1 Else ContinueCase EndIf Case Else ;;ConsoleWrite("Else" & @CRLF) If $iState_1A Then ;;ConsoleWrite("- 1B" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1B, 0XFF0000) $iState_1B = 1 Else ;;ConsoleWrite("- 1A" & @CRLF) $iH -= 1 GUICtrlSetBkColor($cLabel_1A, 0XFF0000) $iState_1A = 1 EndIf EndSwitch WEnd While $iM Switch $iM Case 5 To 12 $bContinueCase = False ;ConsoleWrite("5-12" & @CRLF) Switch $iState_5 Case 0 ;ConsoleWrite("-5:G" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X00FF00) $iState_5 = 2 Case 1 ;ConsoleWrite("-5:B" & @CRLF) $iM -= 5 GUICtrlSetBkColor($cLabel_5, 0X0000FF) $iState_5 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 3 To 12 ;ConsoleWrite("3-12" & @CRLF) $bContinueCase = False Switch $iState_3 Case 0 ;ConsoleWrite("-3:G" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X00FF00) $iState_3 = 2 Case 1 ;ConsoleWrite("-3:B" & @CRLF) $iM -= 3 GUICtrlSetBkColor($cLabel_3, 0X0000FF) $iState_3 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case 2 To 12 ;ConsoleWrite("2-12" & @CRLF) $bContinueCase = False Switch $iState_2 Case 0 ;ConsoleWrite("-2:G" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X00FF00) $iState_2 = 2 Case 1 ;ConsoleWrite("-2:B" & @CRLF) $iM -= 2 GUICtrlSetBkColor($cLabel_2, 0X0000FF) $iState_2 = 2 Case 2 $bContinueCase = True EndSwitch If $bContinueCase Then ContinueCase Case Else Switch $iState_1A Case 2 $iM -= 1 If $iState_1B Then ;ConsoleWrite("-1B:B" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X0000FF) Else ;ConsoleWrite("-1B:G" & @CRLF) GUICtrlSetBkColor($cLabel_1B, 0X00FF00) EndIf Case 1 ;ConsoleWrite("-1A:B" & @CRLF) $iM -= 1 If $iState_1B = 0 Then GUICtrlSetBkColor($cLabel_1B, 0x00FF00) $iState_1B = 1 Else GUICtrlSetBkColor($cLabel_1A, 0x0000FF) $iState_1A = 2 EndIf Case Else ;ConsoleWrite("-1A:G" & @CRLF) $iM -= 1 GUICtrlSetBkColor($cLabel_1A, 0x00FF00) $iState_1A = 1 EndSwitch EndSwitch WEnd EndFunc ;==>_Set_Clock If anyone can produce shorter internal code to colour the labels, please do post it - I found that quite a difficult problem to crack and I am certain I do not have an optimal solution.
      M23
      P.S. The original clock:
       
×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.