Binary Clock
/*
AutoHotkey Version: 1.x
Language: English
Platform: Win9x/XP
Author: tomoe_uehara
Script Function:
Creates a Binary Clock, I got the idea (and how to read it) from http://www.urbanjunkie.co.uk/product.php/426/0/binary-clock
It has autosave window position, alwaysontop, transparent window, and also you can change the colors
Date of Creation:
25/04/2010 - 01:31:42
*/
#NoEnv
#SingleInstance, Force
SendMode Input
SetWorkingDir %A_ScriptDir%
; Default Setting
AOT=0
size=w10 h10
; BinaryClock.INI check
IfExist, %A_ScriptDir%\BinaryClock.ini
Gosub IniRead
Else
Gosub CreateINI
; GUI Menu
Menu, MyMenu, Add, About, About
Menu, MyMenu, Add,
Menu, MyMenu, Add, Always On Top, AOT
Menu, MyMenu, Add, Transparent Window, Trans
Menu, MyMenu, Add, Set GUI Color, SetGUIColor
Menu, MyMenu, Add, Set Clock Color, setclockcolor
Menu, MyMenu, Add,
Menu, MyMenu, Add, Exit, GuiClose
; GUI Create
Gui, color, %guicolor%
Gui, Add, Progress, c%ONColor% Background%OFFColor% x6 y52 %size% vLED3
Gui, Add, Progress, c%ONColor% Background%OFFColor% x6 y72 %size% vLED4
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y12 %size% vLED5
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y32 %size% vLED6
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y52 %size% vLED7
Gui, Add, Progress, c%ONColor% Background%OFFColor% x26 y72 %size% vLED8
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y32 %size% vLED10
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y52 %size% vLED11
Gui, Add, Progress, c%ONColor% Background%OFFColor% x46 y72 %size% vLED12
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y12 %size% vLED13
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y32 %size% vLED14
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y52 %size% vLED15
Gui, Add, Progress, c%ONColor% Background%OFFColor% x66 y72 %size% vLED16
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y32 %size% vLED18
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y52 %size% vLED19
Gui, Add, Progress, c%ONColor% Background%OFFColor% x86 y72 %size% vLED20
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y12 %size% vLED21
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y32 %size% vLED22
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y52 %size% vLED23
Gui, Add, Progress, c%ONColor% Background%OFFColor% x106 y72 %size% vLED24
Gui, -MaximizeBox -MinimizeBox
Gui, Show, h86 w124 x%posx% y%posy%, Binary Clock
Gosub ApplyAOT
WinSet, Transparent, %trans%, Binary Clock
Gosub Check
SetTimer, Check, 1000
Return
IniRead:
IniRead, AOT, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
IniRead, PosX, %A_ScriptDir%\BinaryClock.INI, Setting, PosX, 20
IniRead, PosY, %A_ScriptDir%\BinaryClock.INI, Setting, PosY, 20
IniRead, GUIColor, %A_ScriptDir%\BinaryClock.INI, Setting, GuiColor
IniRead, ONColor, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniRead, OFFColor, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
IniRead, Trans, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Return
CreateINI:
IniWrite, 0, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
IniWrite, 10, %A_ScriptDir%\BinaryClock.INI, Setting, PosX
IniWrite, 10, %A_ScriptDir%\BinaryClock.INI, Setting, PosY
IniWrite, 000000, %A_ScriptDir%\BinaryClock.INI, Setting, GUIColor
IniWrite, 00FF00, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniWrite, 000000, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
IniWrite, 255, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Reload
Return
ApplyAOT:
If AOT = 1
{
Menu, MyMenu, ToggleCheck, Always On Top
WinSet, AlwaysOnTop, On, Binary Clock
}
Return
; The heart of the script...
Check:
Time = %A_Hour%%A_Min%%A_Sec%
Loop, 6
{
T%A_Index% := SubStr(Time, A_Index, 1)
X%A_Index% := bin(T%A_Index%)
}
Binary = %x1%%x2%%x3%%x4%%x5%%x6%
Loop, 24
{
rr := SubStr(Binary, A_Index, 1)
if rr = 1
status%A_Index% = 100
Else
status%A_Index% = 0
power := status%A_Index%
GuiControl,, LED%A_Index%, %power%
}
; The window autosave
IniRead, PosX, %A_ScriptDir%\BinaryClock.INI, Setting, PosX, 20
IniRead, PosY, %A_ScriptDir%\BinaryClock.INI, Setting, PosY, 20
WinGetPos, X, Y,,, Binary Clock
If PosX != X
IniWrite, %X%, %A_ScriptDir%\BinaryClock.INI, Setting, PosX
If PosX != Y
IniWrite, %Y%, %A_ScriptDir%\BinaryClock.INI, Setting, PosY
Return
GuiContextMenu:
Menu, MyMenu, Show
Return
trans:
transold := trans
GUI, 4:Add, Text, w400, Please set the transparency level`n(Have no effect on Windows 9x and NT4)`n`n1 = Invisible, 255 = Opaque
Gui, 4:Add, Slider, Line10 Page10 TickInterval10 ToolTip w400 vtrans Range1-255 g4preview, %trans%
Gui, 4:Add, Text
GUI, 4:Add, Button, Center w400 h40 default g4save, Save
GUI, 4:Add, Button, Center w400 g4cancel, Cancel
Gui, 4:Show,, Transparency Option
Return
4save:
Gui, 4:Submit
IniWrite, %trans%, %A_ScriptDir%\BinaryClock.INI, Setting, Trans
Reload
4cancel:
Gui, 4:Destroy
WinSet, Trans, %transold%, Binary Clock
Return
4preview:
WinSet, Trans, %trans%, Binary Clock
Return
About:
MsgBox, 4160, Do you think you're geek enough?,This Binary Clock is made by tomoe_uehara @ 25/04/2010 - 20:47:35`n`nYou don't know how to read it?`nThen visit http://www.urbanjunkie.co.uk/product.php/426/0/binary-clock`n`n`nI hope you like it... =P, 60
Return
AOT:
WinSet, AlwaysOnTop, toggle, Binary Clock
Menu, MyMenu, ToggleCheck, Always On Top
If AOT = 0
IniWrite, 1, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
Else
IniWrite, 0, %A_ScriptDir%\BinaryClock.INI, Setting, AOT
return
SetGUIColor:
Gui, 2:Destroy
Gui, 2:Add, Text, w300 Bold center, Please specify the background color of the GUI`n(RGB Hex Format)
Gui, 2:Add, Edit, w300 vguicolor Limit6 Uppercase center, %guicolor%
Gui, 2:Add, Text
Gui, 2:Add, Button, w300 h40 default g2save, Save
Gui, 2:Add, Button, w300 g2cancel, Cancel
Gui, 2:show,, Set GUI Color
Return
2save:
gui, 2:submit
IniWrite, %guicolor%, %A_ScriptDir%\BinaryClock.INI, Setting, GUIColor
Reload
2cancel:
gui, 2:destroy
Return
setclockcolor:
Gui, 3:Destroy
Gui, 3:Add, Text, w300 Bold center, Please specify the "ON" clock color.`n(RGB Hex Format)
Gui, 3:Add, Edit, w300 voncolor Limit6 Uppercase center, %ONColor%
Gui, 3:Add, Text
Gui, 3:Add, Text, w300 Bold center, Please specify the "OFF" clock color.`n(RGB Hex Format)
Gui, 3:Add, Edit, w300 voffcolor Limit6 Uppercase center, %OFFColor%
Gui, 3:Add, Text
Gui, 3:Add, Button, w300 h40 default g3save, Save
Gui, 3:Add, Button, w300 g3cancel, Cancel
Gui, 3:show,, Set Clock Color
Return
3save:
gui, 3:submit
IniWrite, %ONColor%, %A_ScriptDir%\BinaryClock.INI, Setting, ONColor
IniWrite, %OFFColor%, %A_ScriptDir%\BinaryClock.INI, Setting, OFFColor
Reload
3cancel:
gui, 3:destroy
Return
GuiClose:
ExitApp
Bin(x){
If x = 0
r = 0000
If x = 1
r = 0001
If x = 2
r = 0010
If x = 3
r = 0011
If x = 4
r = 0100
If x = 5
r = 0101
If x = 6
r = 0110
If x = 7
r = 0111
If x = 8
r = 1000
If x = 9
r = 1001
Return r
}ColorMix
/* AutoHotkey Version: 1.x Language: English Platform: Win9x/XP Author: tomoe_uehara Script Function: A GUI for mix & matching colors Date of Creation: 04-11-08 / 17:47:57 */ #NoEnv #SingleInstance, Force SendMode Input SetWorkingDir %A_ScriptDir% ; --------------------------------- reds = 00 greens = 00 blues = 00 tones = 00 gui destroy gui, add, Text,, Red:`t Gui, Add, Edit, vreds limit2 gbunglon ys, %reds% gui, add, slider, vslidera gslider1 range0-255 tooltip section altsubmit ys w280 tickinterval20 page10 gui, add, Text, xm section, Green:`t Gui, Add, Edit, vgreens limit2 gbunglon ys, %greens% gui, add, slider, vsliderb gslider2 range0-255 tooltip section altsubmit ys w280 tickinterval20 page10 gui, add, Text, xm section, Blue:`t Gui, Add, Edit, vblues limit2 gbunglon ys, %blues% gui, add, slider, vsliderc gslider3 range0-255 tooltip altsubmit ys w280 tickinterval20 page10 Gui, Add, Progress, w360 h240 cwhite vprogre xm background000000 gui, font, s24 gui, add, edit, xm section readonly vproedit, %reds%%greens%%blues% gui, font Gui, Add, Button, w170 h50 ys -tabstop center, E&XIT gui, Add, Button, w40 h50 ys -tabstop center, ? gui -sysmenu +owndialogs -theme +altsubmit Gui, Show,, Color Mix n Match -- tomoe_uehara return button?: ; Added at 01-06-08 / 03:01:34 random, redz, 00, 255 random, greenz, 00, 255 random, bluez, 00, 255 dox = reds dix = %redz% gosub randomizer dox = greens dix = %greenz% gosub randomizer dox = blues dix = %bluez% gosub randomizer return randomizer: SetFormat, integer, hex dix += 0 cuk := dix SetFormat, integer, d StringTrimleft, cuk, dix, 2 dix := cuk guicontrol, text, %dox%, %dix% return slider1: dox = reds dix = %slidera% goto sliders slider2: dox = greens dix = %sliderb% goto sliders slider3: dox = blues dix = %sliderc% goto sliders sliders: SetFormat, integer, hex dix += 0 cuk := dix SetFormat, integer, d StringTrimleft, cuk, dix, 2 dix := cuk length:=StrLen(dix) if length < 2 dix = 0%Dix% guicontrol, text, %dox%, %dix% return bunglon: if reds is not alnum reds = 00 if greens is not alnum greens = 00 if blues is not alnum blues = 00 if tones is not alnum tones = 00 gui, submit, nohide lenred := StrLen(reds) if lenred = 1 reds = 0%reds% lengreen := StrLen(greens) if lengreen = 1 greens = 0%greens% lenblue := StrLen(blues) if lenblue = 1 lentone := StrLen(tones) if lentone = 1 tones = 0%tones% tonex=0x%tones% redx=0x%reds% greenx=0x%greens% bluex=0x%blues% SetFormat, integer, d tonex += 0 redx += 0 greenx += 0 bluex += 0 SetFormat, integer, hex GuiControl +Background%reds%%greens%%blues%, progre guiControl,, slidera, %redx% guiControl,, sliderb, %greenx% guiControl,, sliderc, %bluex% guiControl,, sliderd, %tonex% GuiControl,, proedit, %reds%%greens%%blues% SetFormat, integer, d return ButtonEXIT: exitapp




