;========================================================================================================================================== ; Binary clock ; This version by Detlev Dalitz.20080823. ;========================================================================================================================================== ; Direct WIL to allow itself to be terminated without warning. IntControl (12, 4, 0, 0, 0) ; Enable Close button. IntControl (1008, 1, 0, 0, 0) ; Define some rgb colors. rgbDKBLUE = "0,0,128" rgbBLUE = "0,0,255" rgbLTBLUE = "128,180,255" rgbLTGRAY = "192,192,192" rgbGRAY = "150,150,150" rgbDKGRAY = "64,64,64" rgbGREEN = "0,255,0" rgbRED = "255,0,0" rgbBLACK = "0,0,0" rgbWHITE = "255,255,255" rgbYELLOW = "255,255,0" ; Use colors in this script. rgbColB = rgbBLACK ; Background. rgbColD = rgbDKGRAY ; Decimal values. rgbCol4 = rgbRED ; Hours. rgbCol5 = rgbBLUE ; Minutes. rgbCol6 = rgbGREEN ; Seconds. ; Assign window positions for binary 1 or 0 for hour, minute, second. ; Since we will only see a max value of 59 (111011), we only need 6 positions per item. coordVirtual60 = "800,750,900,900" ; 1 ; Sec coordVirtual61 = "660,750,760,900" ; 2 ; Sec coordVirtual62 = "520,750,620,900" ; 4 ; Sec coordVirtual63 = "380,750,480,900" ; 8 ; Sec coordVirtual64 = "240,750,340,900" ; 16 ; Sec coordVirtual65 = "100,750,200,900" ; 32 ; Sec coordVirtual50 = "800,500,900,650" ; 1 ; Min coordVirtual51 = "660,500,760,650" ; 2 ; Min coordVirtual52 = "520,500,620,650" ; 4 ; Min coordVirtual53 = "380,500,480,650" ; 8 ; Min coordVirtual54 = "240,500,340,650" ; 16 ; Min coordVirtual55 = "100,500,200,650" ; 32 ; Min coordVirtual40 = "800,250,900,400" ; 1 ; Hour coordVirtual41 = "660,250,760,400" ; 2 ; Hour coordVirtual42 = "520,250,620,400" ; 4 ; Hour coordVirtual43 = "380,250,480,400" ; 8 ; Hour coordVirtual44 = "240,250,340,400" ; 16 ; Hour coordVirtual45 = "100,250,200,400" ; 32 ; Hour coordVirtualD0 = "800,000,900,099" ; 1 coordVirtualD1 = "660,000,760,099" ; 2 coordVirtualD2 = "520,000,620,099" ; 4 coordVirtualD3 = "380,000,480,099" ; 8 coordVirtualD4 = "240,000,340,099" ; 16 coordVirtualD5 = "100,000,200,099" ; 32 ; Displays WinBatch boxes. BoxesUp ("0,0,100,128", @NORMAL) BoxCaption (1, "Clock") ; Create a WinBatch box to hold decimal values. BoxNew (3, "0,900,1000,1000", 0) ; Rather weird to set proper coordinates. BoxColor (3, rgbColB, 0) BoxDrawRect (3, "0,0,1000,1000", 2) BoxTextColor (3, rgbColD) BoxTextFont (3, "", 1000, 70, 48) For intBit = 0 To 5 BoxDrawText (3, coordVirtualD%intBit%, (1 << intBit), @TRUE, 1) Next ; Create a WinBatch box to hold binary clock circles. BoxNew (2, "0,0,1000,900", 0) ; Rather weird to set proper coordinates. BoxColor (2, rgbColB, 0) BoxDrawRect (2, "0,0,1000,1000", 2) BoxDataTag (2, "DT") While @TRUE strDT = TimeAdd (TimeYmdHms (), "0:0:0:0:0:1") TimeWait (strDT) BoxCaption (1, strDT) BoxDataClear (2, "DT") BoxUpdates (2, 0) For intDT = 4 To 6 intTime = 0 + ItemExtract (intDT, strDT, ":") For intBit = 0 To 5 rgbCol = rgbColB If !!(intTime & (1 << intBit)) Then rgbCol = rgbCol%intDT% BoxColor (2, rgbCol, 0) BoxDrawCircle (2, coordVirtual%intDT%%intBit%, 2) Next Next BoxUpdates (2, 2) EndWhile Exit ;==========================================================================================================================================