DarkNecromancer Posted January 3, 2006 Share Posted January 3, 2006 (edited) Hmm, I don't know whether to put this in this section or support but i decided to place it in here. I created this clock and never liked it until i finally gave it transparent backgrounds. I finally got it working and it works as far as I can tell, except for one thing; when it updates any of the time rows it defocuses the active window. I don't know of any way of fixing this other then what i did, but it does make it a little bit of a pain. Let me know if you guys improve it, but here is the source with the images Blue ImageGreen ImageRed Image* CORRECTED FOR THE NEXT POST *expandcollapse popup#include <GUIConstants.au3> ;~ #include "ShortCut.au3" ;~ If @compiled Then ShortCut(0, 0) Opt("TrayAutoPause",0) Opt("TrayMenuMode",1) $TraySave = TrayCreateItem ( "Save Position" ) $TrayClose = TrayCreateItem ( "Close" ) HotKeySet("^+{LEFT}", "left") HotKeySet("^+{RIGHT}", "right") HotKeySet("^+{DOWN}", "down") HotKeySet("^+{UP}", "up") Global $LGreen = ("LightGreen.gif") Global $LBlue = ("LightBlue.gif") GLobal $Lred = ("LightRED.gif") $StartX = IniRead( "ClockConfig", "Pos", "x", 0 ) $StartY = IniRead( "ClockConfig", "Pos", "y", 0 ) Global $Lights[3][6] ;First Row $Lights[0][0] = GUICreate("", 15, 15, $StartX+10, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GUICtrlCreatePic( $LRed, 0, 0, 15, 15);red Light Value of 10 $Lights[0][1] = GUICreate("", 15, 15, $StartX+30, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LGreen, 0, 0, 15, 15);Special green Light value of 5 $Lights[0][5] = GUICreate("", 15, 15, $StartX+50, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[0][4] = GUICreate("", 15, 15, $StartX+70, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue,0, 0, 15, 15) $Lights[0][3] = GUICreate("", 15, 15, $StartX+90, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[0][2] = GUICreate("", 15, 15, $StartX+110, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue,0, 0, 15, 15) ;Second Row $Lights[1][4] = GUICreate("", 15, 15, $StartX+10, $StartY+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15);Special Green Light value of 5 $Lights[1][3] = GUICreate("", 15, 15, $StartX+30, $StartY+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[1][2] = GUICreate("", 15, 15, $StartX+50, $StartY+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[1][1] = GUICreate("", 15, 15, $StartX+70, $StartY+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[1][0] = GUICreate("", 15, 15, $StartX+90, $StartY+30,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) ;Third Row $Lights[2][0] = GUICreate("", 15, 15, $StartX+10, $StartY+50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LGreen, 0, 0, 15, 15);Special Green Light Value of 5 $Lights[2][4] = GUICreate("", 15, 15, $StartX+30, $StartY+50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[2][3] = GUICreate("", 15, 15, $StartX+50, $StartY+50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[2][2] = GUICreate("", 15, 15, $StartX+70, $StartY+50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $Lights[2][1] = GUICreate("", 15, 15, $StartX+90, $StartY+50,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) GuiCtrlCreatePic( $LBlue, 0, 0, 15, 15) $OriginalMin = 0 $OriginalHour = 0 While 1 If $OriginalHour <> @HOUR Then ;disable the lights $ActiveTitle = WinGetTitle ( "" ) For $u = 0 to 5 GuiSetState ( @SW_HIDE, $lights[0][$u] ) Next Dim $hour = @Hour If $hour > 12 Then $hour = $hour - 12 EndIf ;Hours If $hour >= 10 Then EnableLight(0,0) For $i = 1 to ($hour-10) EnableLight(0,$i+1) Next ElseIf $hour >= 5 Then EnableLight(0,1) For $i = 1 to ($hour-5) EnableLight(0,$i+1) next Else For $i = 1 to $hour EnableLight(0,$i+1) Next EndIf WinActivate ( $ActiveTitle ) $OriginalHour = @HOUR EndIf If $OriginalMin <> @Min Then $ActiveTitle = WinGetTitle ( "" ) ;disable the lights For $i = 1 to 2 For $u = 0 to 4 GuiSetState ( @SW_HIDE, $lights[$i][$u] ) Next Next ;10's of minutes Dim $10min = @MIN $10Min = ($10Min/10) If StringIsInt ( $10min ) = 0 Then $Data = StringSplit( $10min, ".", 1) $10min = $data[1] EndIf For $i = 1 to $10Min EnableLight(1,$i-1) Next ;The minutes Dim $min = @MIN $min = stringright( $min, 1) If $min >= 5 Then EnableLight(2,0) For $i = 1 to $min-5 EnableLight(2,$i) next Else For $i = 1 to $min EnableLight(2, $i) Next EndIf WinActivate ( $ActiveTitle ) $OriginalMin = @Min EndIf $msg = TrayGetMsg() If $msg = $TrayClose Then $Responce = Msgbox( 4, "Exit", "Are you sure you want to exit?" ) If $Responce = 6 Then Exit EndIf ElseIf $msg = $TraySave Then $Pos = WinGetPos( $Lights[0][0] ) IniWrite( "ClockConfig", "Pos", "x", $Pos[0] ) IniWrite( "ClockConfig", "Pos", "y", $Pos[1] ) EndIf WEnd Func EnableLight($Row,$light) If $light = 1 AND $row = 0 Then GuiSetState ( @SW_SHOW, $lights[0][1] ) ElseIf $light = 0 and $row = 1 Then GuiSetState ( @SW_SHOW, $lights[1][0] ) ElseIf $light = 0 AND $row = 2 Then GuiSetState ( @SW_SHOW, $lights[$Row][0] ) ElseIf $light = 0 Then GuiSetState ( @SW_SHOW, $lights[$Row][0] ) Else GuiSetState ( @SW_SHOW, $lights[$Row][$light] ) EndIf EndFunc Func left () For $i = 0 to 2 For $u = 0 to 5 If $i = 1 OR $i = 2 Then If $u < 5 Then $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0]-10, $pos[1] ) EndIf Else $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0]-10, $pos[1]) EndIf Next Next EndFunc Func right() For $i = 0 to 2 For $u = 0 to 5 If $i = 1 OR $i = 2 Then If $u < 5 Then $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0]+10, $pos[1] ) EndIf Else $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0]+10, $pos[1]) EndIf Next Next EndFunc Func down() For $i = 0 to 2 For $u = 0 to 5 If $i = 1 OR $i = 2 Then If $u < 5 Then $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0], $pos[1]+10 ) EndIf Else $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0], $pos[1]+10) EndIf Next Next EndFunc Func up() For $i = 0 to 2 For $u = 0 to 5 If $i = 1 OR $i = 2 Then If $u < 5 Then $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0], $pos[1]-10 ) EndIf Else $pos = WinGetPos( $Lights[$i][$u] ) WinMove( $Lights[$i][$u], "", $pos[0], $pos[1]-10) EndIf Next Next EndFuncHOW TO READ IT:Red = 10Green = 5Blue = 1The top row is hours, the middle row is 10's of minutes, and the lower row is minutesEXAMPLE5+1+1+11+1+15 = 8:35Hope you guys like it~Dark Edited January 3, 2006 by DarkNecromancer Link to comment Share on other sites More sharing options...
DarkNecromancer Posted January 3, 2006 Author Share Posted January 3, 2006 (edited) oops, i realized a small problem with the placement of the red image. the 27th line should read this $Lights[0][0] = GUICreate("", 15, 15, $StartX+10, $StartY+10,$WS_POPUP,BitOr($WS_EX_LAYERED,$WS_EX_TOPMOST,$WS_EX_TOOLWINDOW)) ~Dark Edited January 3, 2006 by DarkNecromancer Link to comment Share on other sites More sharing options...
Oxin8 Posted January 3, 2006 Share Posted January 3, 2006 That's pretty sweet. Maybe I'll add an alarm to it and to replace my graphic-less alarm clock. ~My Scripts~ *********_XInput UDF for Xbox 360 ControllerSprayPaint_MouseMovePlus Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now