Sign in to follow this  
Followers 0
Darth

Progress bar clock

8 posts in this topic

#1 ·  Posted (edited)

Here is the code and a compiled version with a background

#include<guiconstants.au3>

GUICreate("Progress Bar Clock", 102,110,-1,-1,$WS_POPUP)
FileInstall("D:\Nesecary things\autoit3\alife\bg.bmp", @tempdir & "\Bg.bmp")
GUICtrlCreatePic (@tempdir & "\Bg.bmp" , -1, -1, 0, 0, $SS_CENTERIMAGE)
$lbl1 = GUICtrlCreateLabel ( @HOUR, 2, 5 )
$PBAR1 = GUICtrlCreateProgress(2,20,100,20,$PBS_SMOOTH)
$lbl2 = GUICtrlCreateLabel ( @MIN, 2, 40 )
$PBAR2 = GUICtrlCreateProgress(2,55,100,20,$PBS_SMOOTH)
$lbl3 = GUICtrlCreateLabel ( @SEC, 2, 75 )
$PBAR3 = GUICtrlCreateProgress(2,90,100,20,$PBS_SMOOTH)
GUICtrlSetBkColor ( $lbl1, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $lbl2, $GUI_BKCOLOR_TRANSPARENT )
GUICtrlSetBkColor ( $lbl3, $GUI_BKCOLOR_TRANSPARENT )
GUISetState (@SW_SHOW)

While(1)
    GUICtrlSetData ( $PBAR1, (@HOUR/24) * 100)
    GUICtrlSetData ( $PBAR2, (@MIN/60) * 100)
    GUICtrlSetData ( $PBAR3, (@SEC/60) * 100)
    GUICtrlSetData ( $lbl1 , @HOUR)
    GUICtrlSetData ( $lbl2 , @MIN)
    GUICtrlSetData ( $lbl3 , @SEC)
    

    sleep(1000)
    
    WEnd

Progressbarclock.exe

Edited by Darth

Share this post


Link to post
Share on other sites



Nicely done. Much more fun than the windows stock clock. Keep it up


----------------------------------90% of teens today would die if Myspace,Bebo + FaceBook had a system failure and was completely destroyed. If you are one of the 10% that would be laughing, copy and paste this to your signature.----------------------------------Code to win, 'till you die, 'till the compiler dies from your linesCode to win, take it all, just keep coding till you fallDay by day, codin' all the way, I'm not cavin' inLet another App begin, code to win

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

This inspired me to make one too. Here's my version of an LED style clock. One day I'll make it nice with graphics instead of checkboxes. :D

;#include <GUIConstants.au3>
;#Include <Date.au3>

Const $GUI_SHOW = 16
Const $GUI_HIDE = 32
Const $GUI_DISABLED = 128
Const $GUI_UNCHECKED = 4
Const $GUI_CHECKED = 1
Const $WS_SIZEBOX = 262144

$xWin = @DesktopWidth * .175
$yWin = @DesktopHeight * .175
$gui = GUICreate("Binary Clock",$xWin,$yWin*1.175,-1,-1,$WS_SIZEBOX)
    GUISetBkColor(0x00000)
$mnu = GUICtrlCreateMenu("&Options")
$mnuEasy = GUICtrlCreateMenuItem("Easy View",$mnu)
    GUICtrlSetState(-1,$GUI_UNCHECKED)

$hr10_1 = GUICtrlCreateCheckbox("",1 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hr10_2 = GUICtrlCreateCheckBox("",1 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hr01_1 = GUICtrlCreateCheckBox("",2 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hr01_2 = GUICtrlCreateCheckBox("",2 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hr01_3 = GUICtrlCreateCheckBox("",2 * ($xWin * .1375),1.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hr01_4 = GUICtrlCreateCheckBox("",2 * ($xWin * .1375),0.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$hour10lbl = GUICtrlCreateLabel("0",1.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
$hour01lbl = GUICtrlCreateLabel("0",2.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
    
$sep1lbl = GUICtrlCreateLabel(":",2.656 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)

$min10_1 = GUICtrlCreateCheckBox("",3 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min10_2 = GUICtrlCreateCheckBox("",3 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min10_3 = GUICtrlCreateCheckBox("",3 * ($xWin * .1375),1.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min01_1 = GUICtrlCreateCheckBox("",4 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min01_2 = GUICtrlCreateCheckBox("",4 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min01_3 = GUICtrlCreateCheckBox("",4 * ($xWin * .1375),1.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min01_4 = GUICtrlCreateCheckBox("",4 * ($xWin * .1375),0.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$min10lbl = GUICtrlCreateLabel("0",3.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
$min01lbl = GUICtrlCreateLabel("0",4.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
    
$sep2lbl = GUICtrlCreateLabel(":",4.656 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)

$sec10_1 = GUICtrlCreateCheckBox("",5 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec10_2 = GUICtrlCreateCheckBox("",5 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec10_3 = GUICtrlCreateCheckBox("",5 * ($xWin * .1375),1.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec01_1 = GUICtrlCreateCheckBox("",6 * ($xWin * .1375),3.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec01_2 = GUICtrlCreateCheckBox("",6 * ($xWin * .1375),2.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec01_3 = GUICtrlCreateCheckBox("",6 * ($xWin * .1375),1.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec01_4 = GUICtrlCreateCheckBox("",6 * ($xWin * .1375),0.5 * ($yWin * .185),13,13)
    ;GUICtrlSetState(-1,$GUI_DISABLE)
$sec10lbl = GUICtrlCreateLabel("0",5.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
$sec01lbl = GUICtrlCreateLabel("0",6.06 * ($xWin * .1375), 4.25 * ($yWin * .185),20,20)
    GUICtrlSetColor(-1,0xFFFFFF)
    GUICtrlSetFont(-1,10,600)
    GUICtrlSetState(-1,$GUI_HIDE)
    
PrintTime()
AdlibEnable("PrintTime",1000)
GUISetState()

While 1
    $msg = GUIGetMsg()
    
    If $msg = $mnuEasy Then
        If BitAnd(GUICtrlRead($mnuEasy),$GUI_CHECKED) = $GUI_CHECKED Then
            GUICtrlSetState($mnuEasy,$GUI_UNCHECKED)
            GuiCtrlSetState($hour10lbl,$GUI_HIDE)
            GuiCtrlSetState($hour01lbl,$GUI_HIDE)
            GuiCtrlSetState($min10lbl,$GUI_HIDE)
            GuiCtrlSetState($min01lbl,$GUI_HIDE)
            GuiCtrlSetState($sec10lbl,$GUI_HIDE)
            GuiCtrlSetState($sec01lbl,$GUI_HIDE)
            GuiCtrlSetState($sep1lbl,$GUI_HIDE)
            GuiCtrlSetState($sep2lbl,$GUI_HIDE)
        Else
            GUICtrlSetState($mnuEasy,$GUI_CHECKED)
            GuiCtrlSetState($hour10lbl,$GUI_SHOW)
            GuiCtrlSetState($hour01lbl,$GUI_SHOW)
            GuiCtrlSetState($min10lbl,$GUI_SHOW)
            GuiCtrlSetState($min01lbl,$GUI_SHOW)
            GuiCtrlSetState($sec10lbl,$GUI_SHOW)
            GuiCtrlSetState($sec01lbl,$GUI_SHOW)
            GuiCtrlSetState($sep1lbl,$GUI_SHOW)
            GuiCtrlSetState($sep2lbl,$GUI_SHOW)
        EndIf
    EndIf
    
    If $msg = -3 Then ExitLoop
WEnd
    
Exit    

Func PrintTime()
    $time = @hour & ":" & @min & ":" & @sec
    $timearr = StringSplit($time,":")
    $hour10 = StringLeft($timearr[1],1)
    $hour01 = StringRight($timearr[1],1)
    $min10 = StringLeft($timearr[2],1)
    $min01 = StringRight($timearr[2],1)
    $sec10 = StringLeft($timearr[3],1)
    $sec01 = StringRight($timearr[3],1)
    GUICtrlSetData($hour10lbl,$hour10)
    GUICtrlSetData($hour01lbl,$hour01)
    GUICtrlSetData($min10lbl,$min10)
    GUICtrlSetData($min01lbl,$min01)
    GUICtrlSetData($sec10lbl,$sec10)
    GUICtrlSetData($sec01lbl,$sec01)
;/// Hours - First Digit
    If $hour10 = 2 Then     
        GuiCtrlSetState($hr10_2,$GUI_CHECKED)
    ElseIf $hour10 = 1 Then
        GuiCtrlSetState($hr10_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($hr10_1,$GUI_UNCHECKED)
        GuiCtrlSetState($hr10_2,$GUI_UNCHECKED)
    EndIf
;/// Hours - Second Digit
    If $hour01 >= 8 Then
        $hour01 -= 8
        GuiCtrlSetState($hr01_4,$GUI_CHECKED)
    Else
        GuiCtrlSetState($hr01_4,$GUI_UNCHECKED)
    EndIf
    If $hour01 >= 4 Then
        $hour01 -= 4
        GuiCtrlSetState($hr01_3,$GUI_CHECKED)
    Else        
        GuiCtrlSetState($hr01_3,$GUI_UNCHECKED)
    EndIf
    If $hour01 >= 2 Then
        $hour01 -= 2
        GuiCtrlSetState($hr01_2,$GUI_CHECKED)
    Else
        GuiCtrlSetState($hr01_2,$GUI_UNCHECKED)
    EndIf   
    If $hour01 = 1 Then 
        GuiCtrlSetState($hr01_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($hr01_1,$GUI_UNCHECKED)
    EndIf
;/// Minutes - First Digit  
    If $min10 >= 4 Then
        $min10 -= 4
        GuiCtrlSetState($min10_3,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min10_3,$GUI_UNCHECKED)
    EndIf
    If $min10 >= 2 Then
        $min10 -= 2
        GuiCtrlSetState($min10_2,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min10_2,$GUI_UNCHECKED)
    EndIf
    If $min10 = 1 Then
        GuiCtrlSetState($min10_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min10_1,$GUI_UNCHECKED)
    EndIf
;/// Minutes - Second Digit
    If $min01 >= 8 Then
        $min01 -= 8
        GuiCtrlSetState($min01_4,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min01_4,$GUI_UNCHECKED)
    EndIf
    If $min01 >= 4 Then
        $min01 -= 4
        GuiCtrlSetState($min01_3,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min01_3,$GUI_UNCHECKED)
    EndIf
    If $min01 >= 2 Then
        $min01 -= 2
        GuiCtrlSetState($min01_2,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min01_2,$GUI_UNCHECKED)
    EndIf
    If $min01 = 1 Then
        GuiCtrlSetState($min01_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($min01_1,$GUI_UNCHECKED)
    EndIf
;/// Seconds - First Digit
    If $sec10 >= 4 Then
        $sec10 -= 4
        GuiCtrlSetState($sec10_3,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec10_3,$GUI_UNCHECKED)
    EndIf
    If $sec10 >= 2 Then
        $sec10 -= 2
        GuiCtrlSetState($sec10_2,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec10_2,$GUI_UNCHECKED)
    EndIf
    If $sec10 = 1 Then
        GuiCtrlSetState($sec10_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec10_1,$GUI_UNCHECKED)
    EndIf
;/// Seconds - Second Digit
    If $sec01 >= 8 Then
        $sec01 -= 8
        GuiCtrlSetState($sec01_4,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec01_4,$GUI_UNCHECKED)
    EndIf
    If $sec01 >= 4 Then
        $sec01 -= 4
        GuiCtrlSetState($sec01_3,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec01_3,$GUI_UNCHECKED)
    EndIf
    If $sec01 >= 2 Then
        $sec01 -= 2
        GuiCtrlSetState($sec01_2,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec01_2,$GUI_UNCHECKED)
    EndIf
    If $sec01 = 1 Then
        GuiCtrlSetState($sec01_1,$GUI_CHECKED)
    Else
        GuiCtrlSetState($sec01_1,$GUI_UNCHECKED)
    EndIf
EndFunc

edit: Ok, fixed it. Wasn't math afterall

edit: Added menubar with Easy View mode

Edited by spudw2k

Share this post


Link to post
Share on other sites

thanks guys, I didn't think it was that impressive, was just bored

Share this post


Link to post
Share on other sites

thanks guys, I didn't think it was that impressive, was just bored

Wow, guess it's a good thing we we're writting something for you. We would've blew it. :D

Share this post


Link to post
Share on other sites

huh?

Share this post


Link to post
Share on other sites

nice work :D

Share this post


Link to post
Share on other sites

I couldn't get it to work without a few extra #includes:

#include <WindowsConstants.au3>
#include <StaticConstants.au3>
#include <ProgressConstants.au3>

Thanks.

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  
Followers 0