# Fibonacci Clock

## Recommended Posts

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
_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:

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

When setting to 00 / 00 and pushing "Set User Time" it "goes crazy". Upper smallest square becomes red and the below square is flickering in red / grey!

CPU increases to 100% on one core. Probably an endless loop.

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

##### Share on other sites

UEZ,

Sorry about that - string/number type mismatch. I have forced the correct datatype in the new code above and it works now (for me at least).

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

There is still an issue. When I change the time and push "Set User Time" (a bunch of times) then the CPU increase to 100% on one core again.

I assume there is no exit in one of the While/Wend loops within _Set_Clock() function on some specific values.

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

##### Share on other sites

UEZ,

Why is it always you who has problems with my UDFs?

I cannot reproduce that behaviour when I press the "Set User Time" button repeatedly - it just runs and re-draws the clock (correctly). Can you give me a repeatable selection and button press sequence so I can investigate further.

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

I did random selection, so I cannot give you an exact reproduction. It just happend several times when I stressed your code.

Try this: set it to 00 50 and press the "Set User Time" buttom.

Edited by UEZ

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

##### Share on other sites

Rather go to bed at this time: no bug!

This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

##### Share on other sites

UEZ,

Got it - I told you the code was not optimal.

M23

Edited by Melba23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

Teething troubles aside, this is a really nice idea, M(ondriaan)elba23.

My Contributions and Wrappers

Spoiler

##### Share on other sites

All,

And fixed. ContinueCase does NOT do what I rather stupidly expected it to do when it is used inside another, internal Switch structure to the one I wanted to continue. See first post for new code.

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

Seems to work now.  (not my bad aura)

I'm trying to create a 3D matrix to get rid of the loops within the _Set_Clock function.

Edited by UEZ

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

##### Share on other sites

UEZ,

Great. And my apologies for blaming you - when it was my poor coding that was at fault.

I am looking forward to seeing your version. I did think of using a matrix at one point, but it all got too complicated far too quickly. Although seeing how complicated the loops became it might have been the wrong choice!

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

Is there a need for both 00 and 12 in the hour combo (as it seems to hold fine without)?  and i uglied it up so the combos match the current time on start:

and your 1s are backwards from the example (clock.png - 5:45): not that i suppose it would matter which 1 is the 'first' 1

```GUICtrlSetData(\$cUserHour, "01|02|03|04|05|06|07|08|09|10|11|12" , @Hour)
\$cUserMin = GUICtrlCreateCombo("", \$iMargin_X + 160, \$iButton_Level, 40, 20)
If @Min <= 2 OR @Min > 57 Then \$Min = "00"
If @Min > 2 AND @Min <= 7 Then \$Min = "05"
If @Min > 7 AND @Min <= 12 Then \$Min = "10"
If @Min > 12 AND @Min <= 17 Then \$Min = "15"
If @Min > 17 AND @Min <= 22 Then \$Min = "20"
If @Min > 22 AND @Min <= 27 Then \$Min = "25"
If @Min > 27 AND @Min <= 32 Then \$Min = "30"
If @Min > 32 AND @Min <= 37 Then \$Min = "35"
If @Min > 37 AND @Min <= 42 Then \$Min = "40"
If @Min > 42 AND @Min <= 47 Then \$Min = "45"
If @Min > 47 AND @Min <= 52 Then \$Min = "50"
If @Min > 52 AND @Min <= 57 Then \$Min = "55"
GUICtrlSetData(\$cUserMin, "00|05|10|15|20|25|30|35|40|45|50|55" , \$Min)```

Edited by boththose

```,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)```

##### Share on other sites

boththose,

Is there a need for both 00 and 12 in the hour combo

At the moment setting 00 means that no squares are coloured while they are all coloured for 12. As there is no AM/PM selection, I thought I might make at least that distinction.

As the clock is now working for my good friend UEZ, could I also make clear that I have no interest in developing the code further. So please post your own version in this thread if you want to further develop the concept.

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

UEZ loves his clocks! ☺

Awesome job Melba! You guys are awesome.

Edited by coffeeturtle

##### Share on other sites

All,

OK, I lied - a little update in the first post as I find this a strangely fascinating way of telling the time

Any thoughts out there on how to measure the passing of each minute rather than the current changes on each 5 minute block? Nothing I have thought of so far seems to fit in with the desired Fibonacci zeitgeist.

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

Well, currently I'm stuck at how to split any number from 2 to 12 to number of Fibonacci sequence.

Examples:

11 = 5 + 3 + 2 + 1

6 = 5 + 1 and not 3 + 2 + 1

7 = 5 + 2 and not 5 + 1 + 1

12 = 5 + 3 + 2 + 1 + 1

etc.

Afterwards it is easy to create the 3D array (matrix) which reflects any possible time.

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

##### Share on other sites

This feature also steps up the game.

To add to the challenge, the combinations are picked randomly from all the different ways a number can be displayed. There are, for example, 16 different ways to display 6:30 and you never know which one the clock will use!

```,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)```

##### Share on other sites

UEZ,

I decided to use the fewest possible squares - so 6  would always be represented as 5 + 1 and never 3 + 2 + 1.

boththose,

My poor old brain has enough trouble reading the clock using the algorithm I chose - no way do I want to go anywhere near a random choice display!

M23

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

##### Share on other sites

Can you check this version whether it works properly?

```#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
\$bUserSet = False
\$iPrevMin = -1
\$hGUI = GUICreate("Fibonacci Clock - " & @HOUR & ":" & @MIN & ":" & @SEC, (\$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("1", \$iMargin_X + (\$iSize * 2), \$iMargin_Y, \$iSize - \$iMargin_Inter, \$iSize - \$iMargin_Inter)
\$cLabel_1B = GUICtrlCreateLabel("1", \$iMargin_X + (\$iSize * 2), \$iMargin_Y + \$iSize, \$iSize - \$iMargin_Inter, \$iSize - \$iMargin_Inter)
\$cLabel_2 = GUICtrlCreateLabel("2", \$iMargin_X, \$iMargin_Y, (\$iSize * 2) - \$iMargin_Inter, (\$iSize * 2) - \$iMargin_Inter)
\$cLabel_3 = GUICtrlCreateLabel("3", \$iMargin_X, \$iMargin_Y + (\$iSize * 2), (\$iSize * 3) - \$iMargin_Inter, (\$iSize * 3) - \$iMargin_Inter)
\$cLabel_5 = GUICtrlCreateLabel("5", \$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)

Global \$i, \$aFibMatrix[13][12][5], \$fTimer = TimerInit()
For \$iHr = 0 To 12
For \$iMin = 0 To 11
\$aHr = FibSplit(\$iHr)
\$aMin = FibSplit(\$iMin)
For \$i = 0 To 4
\$aFibMatrix[\$iHr][\$iMin][\$i] = 0xC4C4C4
If \$aHr[\$i] = \$aMin[\$i] Then
If \$aHr[\$i] Then \$aFibMatrix[\$iHr][\$iMin][\$i] = 0x0000FF
Else
If \$aHr[\$i] Then \$aFibMatrix[\$iHr][\$iMin][\$i] = 0xFF0000
If \$aMin[\$i] Then \$aFibMatrix[\$iHr][\$iMin][\$i] = 0x00FF00
EndIf
Next
Next
Next
ConsoleWrite(TimerDiff(\$fTimer) & @CRLF)
GUISetState()

_Reset()

While 1

Switch GUIGetMsg()
Case \$GUI_EVENT_CLOSE
Exit
Case \$cReset
\$bUserSet = False
_Reset()
Case \$cUserSet
_Set_Clock(\$iHour, \$iMin)
\$bUserSet = True
EndSwitch

WEnd

Func Clock()
WinSetTitle(\$hGUI, "", "Fibonacci Clock - " & @HOUR & ":" & @MIN & ":" & @SEC)
If Not \$bUserSet Then
If \$iPrevMin <> Int(@MIN / 5) Then
\$iPrevMin = Int(@MIN / 5)
ConsoleWrite("Clock updated at " & @HOUR & ":" & @MIN & ":" & @SEC & @CRLF)
_Reset()
EndIf
EndIf
EndFunc

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)

;~  ConsoleWrite("Entry: " & \$iH & " - " & \$iM & @CRLF)

GUICtrlSetBkColor(\$cLabel_1A, \$aFibMatrix[\$iH][\$iM][0])
GUICtrlSetBkColor(\$cLabel_1B, \$aFibMatrix[\$iH][\$iM][1])
GUICtrlSetBkColor(\$cLabel_2, \$aFibMatrix[\$iH][\$iM][2])
GUICtrlSetBkColor(\$cLabel_3, \$aFibMatrix[\$iH][\$iM][3])
GUICtrlSetBkColor(\$cLabel_5, \$aFibMatrix[\$iH][\$iM][4])

EndFunc   ;==>_Set_Clock

Func FibSplit(\$iNumber)
Local \$aFib[5] = [5, 3, 2, 1, 1], \$i = 0
Local \$aBits[5]
While 1
\$iNumber -= \$aFib[\$i]
If \$iNumber > -1 Then
\$aBits[4 - \$i] = 1
Else
\$aBits[4 - \$i] = 0
\$iNumber += \$aFib[\$i]
EndIf
\$i += 1
If \$i = 5 Then ExitLoop
WEnd
Return \$aBits
EndFunc```

Thanks.

Instead of creating a matrix it is also possible to code 0-12 into bits...

Edited by UEZ
added real time clock display + avoid updating clock every 250 ms

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

## Create an account

Register a new account

• ### Similar Content

• By CarlD
TalkTock is a talking clock. It's configurable via the opening screen, an .ini file, or the command line. The .ini offers the widest range of options, including language preferences.
ReadMe TalkTock.zip: contains .exe, .ini files, ReadMe and ListVoices.exe (TTS utility) Source:
Settings file for TalkTock.exe, Talking Clock ; [TalkTock] ;; Interval between time announcements, in minutes Interval=15 ;; 12- or 24-hour clock ClockStyle=12 ;; Say AM/PM? 1=Yes 0=No; applies to 12-hour clock only SayAMPM=1 ;; TTS voice Voice=default ;Voice=Microsoft George ;; Volume, range 1 to 100 Volume=80 ;; Speaking rate, range -10 to 10 TalkRate=0 ;; Clock stop timer units ;; S=secs M=mins H=hours D=days W=weeks T=months Y=years ClockTimerUnits=H ;; Clock stops after how many timer units? (0 = clock never stops) ClockStops=0 ;; Quiet operation, time shown on screen (1=yes 0=no) Quiet=0 ;; Duration, in seconds, of on-screen time display ;; Fractional (decimal) values are allowed (e.g., Display=3.5) Display=2.5 [Language] ;; Translate the phrases and labels below into your chosen language. ;; Any language with a TTS function (a "Voice") in its language pack ;; should work. To use other languages, edit TalkTock.ini using the ;; UTF-8 character set ; ;; TimeOnly: 1=Yes (phrases set below will NOT be spoken); 0=No TimeOnly=0 ; onStart=Welcome to TalkTock, the Talking Clock Intro=The time will be announced every Freq1=minnit Freq5=5 minutes at the 5-minute mark Freq10=10 minutes at the 10-minute mark Freq15=15 minutes on the quarter hour Freq30=30 minutes on the half hour Freq60='our on the hour FreqCustom=minutes ;; Spoken prefix Prefix=It's ;; No prefix (just announce the time): ;Prefix= ;Prefix=It's ;Prefix=It's now ;Prefix=The time is ;; Singular prefix: Prefix1 defines the singular inflection ;; for "one o'clock" in applicable languages, e.g., Italian ;Prefix1= ; ;; Postfix pairs (optional) ;; ------------------------ ;; Alternatives to saying "AM/PM" (or equivalent) after the time ;; If time falls within Range, TalkTock says ;; Phrase after saying the time ;; You can set as many, or as few, of these pairs as you like ;; Note: Range# settings must have content (a time range hhmm-hhmm) ;; Phrase# settings can be a phrase or empty (say nothing) ;Range1=0000-0000 ;Phrase1=Midnight ;Range2=0001-0329 ;Phrase2=A.M. ;Range3=0330-1159 ;Phrase3=in the morning ;Range4=1200-1200 ;Phrase4=Noon ;Range5=1201-1659 ;Phrase5=in the afternoon ;Range6=1700-1959 ;Phrase6=in the evening ;Range7=2000-2359 ;Phrase7=at night ;; ------------------------ ; ;; Pause/Resume/Stop onPause=TalkTock paused onResume=TalkTock resumed onStop=Goodbye [GUI_Labels] Title=TalkTock - Talking Clock Top=Say the time every Minute=minute Minutes=minutes QuarterHour=quarter hour HalfHour=half hour Hour=hour Hours=hours CustomLabel=Custom ClockStyle=Clock style 12-hour_Label=12-hour 24-hour_Label=24-hour Quiet_label=Time is: Speak_label=spoken Display_label=displayed ClockStop_Label=Clock stops ClockStopsNever_Label= Never ClockStopsAfter_Label= After ClockStopsAfterSecs_Label=secs ClockStopsAfterMins_Label=mins ClockStopsAfterHours_Label=hours ClockStopsAfterDays_Label=days ClockStopsAfterWeeks_Label=weeks ClockStopsAfterMons_Label=months ClockStopsAfterYears_Label=years Volume_Label=Volume ClockStop_Label=Clock stops ClockStopsAfter_Label=After ClockStopsHours_Label=hours ClockStopsNever_Label=Never Start_button=Start Cancel_button=Cancel Tray_pause=Pause Tray_resume=Resume Tray_exit=Stop Enjoy!
• By UEZ

Requires Windows7+ OS!

Widget style GUI:

GUI version (discontinued):
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!

• 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
• 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
• By UEZ
Here my contribution to the clock fever - nothing special rather a fast hack:

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.
×

• Wiki

• Back

• #### Beta

• Git
• FAQ
• Our Picks
×
• Create New...