
Original forum post: http://www.autohotkey.com/board/topic/8 ... ary-clock/
Code:
Code: Select all
On := "?"
Off := "?"
Blank := " "
Code: Select all
● = Chr(9679)
○ = Chr(9675)
Thanks! I want to do a recopilation of my favourite scripts!! And this script, it will be in this recopilation.jNizM wrote:@empardopo
You can use my tool for something like this
TextConverter
@GeekDudeCode: Select all
● = Chr(9679) ○ = Chr(9675)
Nice little tool
suggestions for improvement: Use Chr(n) for better compatibility (like above) and chooseable colors
I think this is my problemGeekDude wrote:I can't say I know what is going wrong for you, but it works fine in my Windows 10 VM
It would be much more helpful if you could explain just what isn't working. E.g. does the window open, but the dots just aren't there?
Code: Select all
On := Chr(9679)
Off := Chr(9675)
The program works fine in W7 64 bits.GeekDude wrote:Does it not display at all, or does it display as broken ANSI? Does it display correctly when using Chr()?
OK, Thanks.GeekDude wrote:File encoding change perhaps? You can post your derivative work, I don't see any reason not to
Code: Select all
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
#SingleInstance,Force
#NotrayIcon
ficheroIni = %A_WorkingDir%\BinClock.ini
if !(FileExist(ficheroIni)){
MsgBox, 262192, Warning, The BinClock ini file doesn't exist. The program will create one automatically.
CrearIniFile(ficheroIni)
ExitApp
}
global SizeFont,ClockX,ClockY,AlarmClock,OnCharacter,OffCharacter,ColorFont,ColorClock,ClockSizeFont,TimeToShowClock,ColorWindowAlarm
ReadFromIni(ficheroIni)
;~ On := Chr(9679)
;~ Off := Chr(9675)
On := Chr(OnCharacter)
Off := Chr(OffCharacter)
Blank := " "
;SizeFont := 13
global showTime,TimeS
showTime := 0
TimeS := ""
Inicio:
Gui, Color, Black
Gui, font, s%SizeFont% c%ColorFont%, Courier New
Gui, Add, Text, vDisplay, % MakeDisplay(On, Off, Blank)
Gui, font, s%ClockSizeFont% c%ColorClock%, Courier New
;Gui, Add, Text, x22 y+0 vMhoraActual +Center, -00:00:00
Gui, Add, Text, x1 y+0 w120 vMhoraActual +Center, %TimeS%
Gui, +ToolWindow +E0x40000 +AlwaysOnTop -Caption ;added -Caption
Gui, Color, 000111 ;added
Gui, Show,x%ClockX% y%ClockY%, BinClock ;added x and y coords
WinSet, Transcolor, 000111, BinClock ;added
SetTimer, UpdateDisplay, 1000
return
!F1::
SizeFont++
Gui,Destroy
Gosub, Inicio
;Reload
return
!F2::
SizeFont--
Gui,Destroy
Gosub, Inicio
return
!F3::
if (showTime==0){
showTime=1
if (TimeToShowClock != 0){
SetTimer, UpdateShowTimeTo0, %TimeToShowClock%
}
}else if (showTime==1){
showTime=0
}
;ValorTime()
return
UpdateDisplay:
GuiControl, Text, Display, % MakeDisplay(On, Off, Blank)
;GuiControl,, MhoraActual, %A_Hour%:%A_Min%:%A_Sec%
ValorTime()
GuiControl,, MhoraActual, %TimeS%
;alarm = 16:00:00
HoraActual = %A_Hour%:%A_Min%:%A_Sec%
if (CheckAlarmaClock(HoraActual,alarmClock)){
PantallaColor()
}
return
UpdateShowTimeTo0:
showTime=0
SetTimer, UpdateShowTimeTo0, Off
return
!Esc::
GuiClose:
ExitApp
return
CheckAlarmaClock(ActualTime,Alarm){
if(ActualTime == Alarm){
resultado = 1
}else{
resultado = 0
}
return resultado
}
ValorTime()
{
if (showTime==0){
TimeS := ""
}else if (showTime==1){
TimeS = %A_Hour%:%A_Min%:%A_Sec% a%AlarmClock%
}
}
MakeDisplay(On, Off, Blank, Stamp="")
{
FormatTime, T, %Stamp%, HH:mm:ss
T := StrSplit(T), LedMask := 0xFE0FE0FC
Loop, 4
{
y := A_Index, Out .= "`n"
Loop, 8
Out .= !(LedMask & 1<<A_Index*4+y-5) ? Blank : (T[A_Index] & 1<<4-y) ? On : Off
}
return SubStr(Out, 2)
}
PantallaColor()
{
Loop
{
Gui,2: Color, %ColorWindowAlarm%
Gui,2: +ToolWindow -Caption ; +ToolWindow prevents taskbar button. -Caption removes borders and stuff.
Gui,2: Show, x0 y0 w%A_ScreenWidth% h%A_ScreenHeight%
Sleep, 250 ; This is the duration of the black screen
Gui,2: Hide
Sleep 2000
}
}
CrearIniFile(ficheroIni){
tempo := "16:00:00"
IniWrite,9679, %ficheroIni%,option,OnCharacter
IniWrite,9675, %ficheroIni%,option,OffCharacter
IniWrite,13, %ficheroIni%,option,SizeFont
IniWrite,0x0000ff, %ficheroIni%,option,ColorFont
IniWrite,600, %ficheroIni%,option,ClockX
IniWrite,600, %ficheroIni%,option,ClockY
IniWrite,8, %ficheroIni%,option,ClockSizeFont
IniWrite,0xff0000, %ficheroIni%,option,ColorClock
IniWrite,4000, %ficheroIni%,option,TimeToShowClock
IniWrite,%tempo%, %ficheroIni%,option,AlarmClock
IniWrite,0xff0000, %ficheroIni%,option,ColorWindowAlarm
}
ReadFromIni(ficheroIni){
if (FileExist(ficheroIni)){
IniRead, OnCharacter, %ficheroIni%,option,OnCharacter
IniRead, OffCharacter, %ficheroIni%,option,OffCharacter
IniRead, SizeFont, %ficheroIni%,option,SizeFont
IniRead, ColorFont, %ficheroIni%,option,ColorFont
IniRead, ClockX, %ficheroIni%,option,ClockX
IniRead, ClockY, %ficheroIni%,option,ClockY
IniRead, ClockSizeFont, %ficheroIni%,option,ClockSizeFont
IniRead, ColorClock, %ficheroIni%,option,ColorClock
IniRead, TimeToShowClock, %ficheroIni%,option,TimeToShowClock
IniRead, AlarmClock, %ficheroIni%,option,AlarmClock
IniRead, ColorWindowAlarm, %ficheroIni%,option,ColorWindowAlarm
}
}
Code: Select all
[option]
OnCharacter=9679
OffCharacter=9675
SizeFont=13
ColorFont=0x0000ff
ClockX=1740
ClockY=940
ClockSizeFont=7
ColorClock=0x0000ff
TimeToShowClock=4000
AlarmClock=16:00:00
ColorWindowAlarm=0xff0000
Return to “Scripts and Functions (v1)”
Users browsing this forum: No registered users and 16 guests