Sign in to follow this  
Followers 0

FlipClock

14 posts in this topic

Posted (edited)

This is a clock, and it has the flip alarm clock style.

Posted Image

-Choose between 24 hour and 12 hour.

-Change how the date shows, if you want to show the date.

Alarm Clock.rar

Previous DLs: 151

Edited by billthecreator

Share this post


Link to post
Share on other sites



Posted

Nice idea, but wrong realization of the main loop, try this:

$CurrentTime = @HOUR & @MIN

While 1
	If $CurrentTime <> @HOUR & @MIN Then
		$CurrentTime = @HOUR & @MIN
		_SetClock($Format, 100)
	EndIf
	
	Switch GUIGetMsg()
		Case $GUI_EVENT_CLOSE
			Exit
		Case $SwitchPicture
			If $Format = 24 Then
				GUICtrlSetImage($SwitchPicture, "Switch12.bmp")
				$Format = 12
			Else
				GUICtrlSetImage($SwitchPicture, "Switch24.bmp")
				$Format = 24
			EndIf
			_SetClock($Format, 100)
		Case $24
			GUICtrlSetImage($SwitchPicture, "Switch24.bmp")
			$Format = 24
			_SetClock($Format, 100)
		Case $12
			GUICtrlSetImage($SwitchPicture, "Switch12.bmp")
			$Format = 12
			_SetClock($Format, 100)
	EndSwitch
WEnd

:)

Share this post


Link to post
Share on other sites

Posted

Oh yes, and the images are not downloaded with «www», add «http://» instead.

Share this post


Link to post
Share on other sites

Posted

Oh yes, and the images are not downloaded with «www», add «http://» instead.

Thanks for noticing..

With both issues.

Share this post


Link to post
Share on other sites

Posted

Nice. One of the few scripts that I've written (and am still writing..) is a sort of a sleep timer/alarm clock. I would like to integrate this type of display into it, a 'current time/countdown time/alarm time' thing..

Share this post


Link to post
Share on other sites

Posted

Nice. One of the few scripts that I've written (and am still writing..) is a sort of a sleep timer/alarm clock. I would like to integrate this type of display into it, a 'current time/countdown time/alarm time' thing..

go right ahead.

the reason i post here...

Share this post


Link to post
Share on other sites

Posted

very nice work :)

Share this post


Link to post
Share on other sites

Posted (edited)

Added update, first post.

This includes new images. cleaner and nicer.

Also a gear looking thing next to each flip rack.

And I added the date.

If you have the previous version, the number images wont

change. You must delete the existing ones in the ScriptDir and rerun the script.

Edited by billthecreator

Share this post


Link to post
Share on other sites

Posted

My advice to you - don't post scripts like this. Better attach all the needed files together in one archive.

In the last version i getting error due to missing Icons.au3.

Share this post


Link to post
Share on other sites

Posted

My advice to you - don't post scripts like this. Better attach all the needed files together in one archive.

In the last version i getting error due to missing Icons.au3.

Thanks again. I forgot to add and mention that.

Share this post


Link to post
Share on other sites

Posted (edited)

I advise you to download a new version Icons.au3.

EDIT:

And may be better to get rid of the window title?

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Icons.au3>
#include <Date.au3>
;
;Created By William Reithmeyer
;Bitmaps done by William Reithmeyer
;
;
ProgressOn("Loading...", "")
For $File = 0 To 9
	While Not FileExists($File & "TOP.bmp")
		InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/" & $File & "TOP.bmp", @ScriptDir & "\" & $File & "TOP.bmp")
	WEnd
	While Not FileExists($File & "BOT.bmp")
		InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/" & $File & "BOT.bmp", @ScriptDir & "\" & $File & "BOT.bmp")
	WEnd
	ProgressSet(($File/13)*100)
Next
While Not FileExists("Switch24.png")
	InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/Switch24.png", @ScriptDir & "\Switch24.png")
WEnd
	ProgressSet((11/13)*100)
While Not FileExists("Switch12.png")
	InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/Switch12.png", @ScriptDir & "\Switch12.png")
WEnd
	ProgressSet((12/13)*100)
While Not FileExists("Gear.png")
	InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/Gear.png", @ScriptDir & "\Gear.png")
WEnd
While Not FileExists("Icons.au3")
	InetGet("http://myautoit.angelfire.com/Clock/AlarmStyle/Icons.au3", @ScriptDir & "\Icons.au3")
WEnd
	ProgressSet((13/13)*100)
	ProgressOff()
;
$Format = 24

$Form1 		= GUICreate("Clock", 480, 176, -1, -1, $WS_POPUP)
			GUISetBkColor(0x000000)

GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")

$hRgn = _WinAPI_CreateRoundRectRgn(0, 0, 480, 175, 50, 50)
_WinAPI_SetWindowRgn($Form1, $hRgn)
		
For $j = 0 To 1 
	GUICtrlCreateLabel("", 16 +($j*232), 37, 8, 29)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
	GUICtrlCreateLabel("", 16 +($j*232), 68, 8, 40)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
	GUICtrlCreateLabel("", 108 +($j*232), 37, 8, 29)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
	GUICtrlCreateLabel("", 108 +($j*232), 68, 8, 40)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
	GUICtrlCreateLabel("", 120 +($j*232), 37, 8, 29)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
	GUICtrlCreateLabel("", 120 +($j*232), 68, 8, 40)
	GUICtrlSetBkColor(-1, 0xFFFFFF)
Next

$GearOneLeft	= GUICtrlCreatePic("", 8, 38, 16, 65)
_SetImage($GearOneLeft, 'Gear.png')
	
$GearOneRight	= GUICtrlCreatePic("", 110, 38, 16, 65)
_SetImage($GearOneRight, 'Gear.png')

$GearTwoLeft	= GUICtrlCreatePic("", 240, 38, 16, 65)
_SetImage($GearTwoLeft, 'Gear.png')
	
$GearTwoRight	= GUICtrlCreatePic("", 342, 38, 16, 65)
_SetImage($GearTwoRight, 'Gear.png')

$HourOneTop = GUICtrlCreatePic("", 16, 16, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$HourOneBot = GUICtrlCreatePic("", 16, 68, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)

$HourTwoTop = GUICtrlCreatePic("", 120, 16, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$HourTowBot = GUICtrlCreatePic("", 120, 68, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)

$MinOneTop 	= GUICtrlCreatePic("", 248, 16, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$MinOneBot 	= GUICtrlCreatePic("", 248, 68, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)

$MinTwoTop 	= GUICtrlCreatePic("", 352, 16, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)
$MinTwoBot 	= GUICtrlCreatePic("", 352, 68, 100, 50, BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS))
GUICtrlSetState(-1, $GUI_DISABLE)

$TodayLabel = GUICtrlCreateLabel(_DateDayOfWeek(@WDAY) & ", " & _DateToMonth(@MON) & " " & @MDAY & ", " & @YEAR, 0, 134, 480, 14, $SS_CENTER)
			GUICtrlSetColor(-1, 0xFFFFFF)
			
$HourLabel 	= GUICtrlCreateLabel("HOURS", 16, 120, 204, 14, $SS_CENTER)
			GUICtrlSetColor(-1, 0xFFFFFF)
$MinLabel 	= GUICtrlCreateLabel("MINUTES", 248, 120, 204, 14, $SS_CENTER)
			GUICtrlSetColor(-1, 0xFFFFFF)
			
$PMLabel 	= GUICtrlCreateLabel("PM", 456, 16, 20, 17)
			GUICtrlSetColor(-1, 0xFFFFFF)
			GUICtrlSetState(-1, $GUI_HIDE)
$AMLabel 	= GUICtrlCreateLabel("AM", 456, 35, 20, 17)
			GUICtrlSetColor(-1, 0xFFFFFF)
			GUICtrlSetState(-1, $GUI_HIDE)
			
$24			= GUICtrlCreateLabel("24", 10, 152, 36, 21, $SS_RIGHT)
			GUICtrlSetColor(-1, 0xFFFFFF)
$12			= GUICtrlCreateLabel("12", 104, 152, 36, 21)
			GUICtrlSetColor(-1, 0xFFFFFF)
$SwitchPicture = GUICtrlCreatePic("", 50, 147, 52, 24)
_SetImage($SwitchPicture, 'Switch24.png')


Set_Time(0, 0, $MinOneTop, $MinOneBot, $MinTwoTop, $MinTwoBot, 0)
Set_Time(0, 0, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, 0)
GUISetState(@SW_SHOW)
;
Sleep(750)
Local $del = 65
$Min = StringSplit(@MIN, "")
For $u = 0 To $Min[2]
	Set_Time(0, $u, $MinOneTop, $MinOneBot, $MinTwoTop, $MinTwoBot, $del)
Next
For $i = 0 To $Min[1]
	Set_Time($i, $u-1, $MinOneTop, $MinOneBot, $MinTwoTop, $MinTwoBot, $del)
Next
$Hr = StringSplit(@HOUR, "")
For $u = 0 To $Hr[2]
	Set_Time(0, $u, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
Next
For $i = 0 To $Hr[1]
	Set_Time($i, $u-1, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
Next

_SetClock($Format, 125)
$CurrentTime = @HOUR & @MIN
;
While 1
    If $CurrentTime <> @HOUR & @MIN Then
        $CurrentTime = @HOUR & @MIN
        _SetClock($Format, 100)
    EndIf
    
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $SwitchPicture
            If $Format = 24 Then
				_SetImage($SwitchPicture, 'Switch12.png')
                $Format = 12
            Else
				_SetImage($SwitchPicture, 'Switch24.png')
                $Format = 24
            EndIf
            _SetClock($Format, 50, 1)
        Case $24
			_SetImage($SwitchPicture, 'Switch24.png')
            $Format = 24
            _SetClock($Format, 50, 1)
        Case $12
			_SetImage($SwitchPicture, 'Switch12.png')
            $Format = 12
            _SetClock($Format, 50, 1)
    EndSwitch
WEnd

Func WM_NCHITTEST($hWnd, $iMsg, $wParam, $lParam)
  if ($hWnd = $Form1) and ($iMsg = $WM_NCHITTEST) then Return $HTCAPTION
EndFunc

Func _SetClock($HHFormat, $Delay, $var = "")
	$Hour   = StringSplit(_Format_Time(@HOUR, $HHFormat), "")
	$Minute = StringSplit(@MIN, "")
	
	If $var = 1 Then
		$step = 1
		$HH  = StringSplit(@HOUR, "")
		$fHH = StringSplit(_Format_Time(@HOUR, $HHFormat), "")
		If $fHH[2] < $HH[2] Then $step = -1
		
		If $Format = 12 Then
			For $u = $HH[2] To $fHH[2] Step $step
				Set_Time($HH[1], $u, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
			Next
			$step = 1
			If $fHH[1] < $HH[1] Then $step = -1
			For $i = $fHH[1] To $HH[2] Step $step
				Set_Time($i, $u-1, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
			Next
		Else
			For $u = $fHH[2] To $HH[2] Step $step
				Set_Time($HH[1], $u, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
			Next
			$step = 1
			If $fHH[1] < $HH[1] Then $step = -1
			For $i = $fHH[1] To $HH[1] Step $step
				Set_Time($i, $u-1, $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $del)
			Next
		EndIf
	EndIf
	
	If $HHFormat = 12 Then
		Set_12Format(@HOUR)
	Else
		Set_12Format()		
	EndIf
	
	Set_Time($Minute[1], $Minute[2], $MinOneTop, $MinOneBot, $MinTwoTop, $MinTwoBot, $Delay)
	Set_Time($Hour[1], $Hour[2], $HourOneTop, $HourOneBot, $HourTwoTop, $HourTowBot, $Delay)
EndFunc
;
Func Set_Time($FirstNum, $SecNum, $FirstTop, $FirstBot, $SecTop, $SecBot, $Delay)
	GUICtrlSetImage($SecTop, $SecNum & "TOP.bmp")
		Sleep($Delay)
	GUICtrlSetImage($SecBot, $SecNum & "BOT.bmp")
	;
	GUICtrlSetImage($FirstTop, $FirstNum & "TOP.bmp")
		Sleep($Delay)
	GUICtrlSetImage($FirstBot, $FirstNum & "BOT.bmp")
EndFunc
;
Func _Format_Time($Hours, $HH_Format)
	Switch $HH_Format
		Case 24
			Return $Hours
		Case 12
			Switch $Hours
				Case 13 To 23
					$Hours = $Hours - 12
					If StringLen($Hours) = 1 Then $Hours = "0" & $Hours					
					Return $Hours
				Case 00
					Return 12
				Case Else
					Return $Hours
			EndSwitch
		Case Else
			Return $Hours
	EndSwitch
EndFunc
;
Func Set_12Format($APHours = "")
	If $APHours = "" Then
		GUICtrlSetState($AMLabel, $GUI_HIDE)
		GUICtrlSetState($PMLabel, $GUI_HIDE)
	Else
		If $APHours > 11 Then
			GUICtrlSetState($AMLabel, $GUI_HIDE)
			GUICtrlSetState($PMLabel, $GUI_SHOW)
		Else
			GUICtrlSetState($AMLabel, $GUI_SHOW)
			GUICtrlSetState($PMLabel, $GUI_HIDE)
		EndIf
	EndIf
EndFunc
Edited by Yashied

Share this post


Link to post
Share on other sites

Posted

hello i try to run this script but show a error

C:Documents and SettingsAUTOMATIONMy DocumentsDownloadsAlarm ClockClock.au3 (8) : ==> Error opening the file.:
#Include "GuiCtrlOnChangeRegister.au3"

how fix that ? thanks

Share this post


Link to post
Share on other sites

Posted

hello i try to run this script but show a error

C:Documents and SettingsAUTOMATIONMy DocumentsDownloadsAlarm ClockClock.au3 (8) : ==> Error opening the file.:

#Include "GuiCtrlOnChangeRegister.au3"

how fix that ? thanks

Delete that include line, it's not needed.

Share this post


Link to post
Share on other sites

Posted

oh thanks , i test now  and work fine ,  thanks mikee

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