RAMzor Posted November 14, 2005 Posted November 14, 2005 Hi! This is my first code posted here. It's few bugy and not ended (sorry) because was written in 1 hour jast for fun - but work! Feel free to change and use my code expandcollapse popup; www ; (o o) ;=================ooO=(_)=Ooo==================== ; Igal 10.11.2005 ;================================================ #include <GuiConstants.au3> $gWidth = 213 $gHeight = 210 GuiCreate("LED Watch", $gWidth, $gHeight,(@DesktopWidth-$gWidth)/2, (@DesktopHeight-$gHeight)/2 );, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) GUISetBkColor(0x4B63A5) ;~ GUICtrlSetColor(-1, 0x384DB8) Dark gray 65708B $Ref_1 = GuiCtrlCreateLabel("", 100, 170, 10, 10) $Ref_2 = GuiCtrlCreateLabel("", 170, 100, 10, 10) $Ref_3 = GuiCtrlCreateLabel("", 100, 28, 10, 10) $Ref_4 = GuiCtrlCreateLabel("", 30, 100, 10, 10) $Bell = GuiCtrlCreateLabel("A", 70, 70, 20, 20) GUICtrlSetFont( $Bell, 9, 400, 0, "MS Outlook" ) $Clock = GuiCtrlCreateLabel("00:00", 53, 83, 100, 50) GUICtrlSetFont( $Clock, 30, 950, 0, "Times New Roman" ) Dim $Label[62], $Loop, $PntPos[62][2] $OffsetX = 100 $OffsetY = 100 $Radius = 80 $NoOfPoints = 60 $pi = 3.14159265358979 $Angle = -($pi/2) ;~ $Center = GuiCtrlCreateLabel("", $OffsetX, $OffsetY, 10, 10) ; Circle points calculation For $i = 1 To $NoOfPoints $t = $i * (2*$pi) / $NoOfPoints $PntPos[$i][0] = $Radius * Cos( $t + $Angle ); X axy $PntPos[$i][1] = $Radius * Sin( $t + $Angle ); Y axy Next GuiSetState() While 1 $msg = GuiGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else $Test = GuiCtrlCreateLabel("", $PntPos[@SEC + 1][0] + $OffsetX, $PntPos[@SEC + 1][1] + $OffsetY, 5, 10) ;~ GUICtrlSetFont( -1, 15, 400, 0, "Times New Roman" ); Bold points If @SEC = 59 Then $Loop = NOT $Loop If $Loop = 1 Then GUICtrlSetColor ( $Test, 0x4B63A5 ); "Transparent" Else GUICtrlSetColor ( $Test, 0xEEC716 ); Blue EndIf GUICtrlSetData ( $Clock, @HOUR & ":" & @MIN ) Sleep(200) EndSelect WEnd Exit
poisonkiller Posted November 14, 2005 Posted November 14, 2005 Its cool thing, but can you do that it "restarts" himself, because its counting only 1 min on my computer.
GaryFrost Posted November 14, 2005 Posted November 14, 2005 (edited) eventually you'll exceed the limit of controls by creating labels for each step, instead create the labels first then just change the color expandcollapse popup; www ; (o o) ;=================ooO=(_)=Ooo==================== ; Igal 10.11.2005 ;================================================ #include <GuiConstants.au3> $gWidth = 213 $gHeight = 210 GUICreate("LED Watch", $gWidth, $gHeight, (@DesktopWidth - $gWidth) / 2, (@DesktopHeight - $gHeight) / 2);, $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS) GUISetBkColor(0x0000ff) ;~ GUICtrlSetColor(-1, 0x384DB8) Dark gray 65708B $Ref_1 = GUICtrlCreateLabel("•", 100, 170, 10, 10) $Ref_2 = GUICtrlCreateLabel("•", 170, 100, 10, 10) $Ref_3 = GUICtrlCreateLabel("•", 100, 28, 10, 10) $Ref_4 = GUICtrlCreateLabel("•", 30, 100, 10, 10) $Bell = GUICtrlCreateLabel("A", 70, 70, 20, 20) GUICtrlSetFont($Bell, 9, 400, 0, "MS Outlook") $Clock = GUICtrlCreateLabel("00:00", 53, 83, 100, 50) GUICtrlSetFont($Clock, 30, 950, 0, "Times New Roman") Dim $Label[62], $Loop, $PntPos[62][2] $OffsetX = 100 $OffsetY = 100 $Radius = 80 $NoOfPoints = 60 $pi = 3.14159265358979 $Angle = - ($pi / 2) ;~ $Center = GuiCtrlCreateLabel("•", $OffsetX, $OffsetY, 10, 10) ; Circle points calculation For $i = 1 To $NoOfPoints $t = $i * (2 * $pi) / $NoOfPoints $PntPos[$i][0] = $Radius * Cos($t + $Angle); X axy $PntPos[$i][1] = $Radius * Sin($t + $Angle); Y axy Next Dim $sec_lbls[60] $sec_color = 0x000000 For $x = 0 To 59 $sec_lbls[$x] = GUICtrlCreateLabel("•", $PntPos[$x + 1][0] + $OffsetX, $PntPos[$x + 1][1] + $OffsetY, 5, 10) GUICtrlSetColor($sec_lbls[$x], $sec_color) Next GUISetState() $sec_color = 0xffffff $hold_sec = @SEC $hold_hour = -1 $hold_min = -1 While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else If @SEC <> $hold_sec Then $hold_sec = @SEC If $hold_hour <> @HOUR Or $hold_min <> @MIN Then GUICtrlSetData($Clock, @HOUR & ":" & @MIN) $hold_hour = @HOUR $hold_min = @MIN EndIf If @SEC = 0 Then GUICtrlSetColor($sec_lbls[59], 0x000000) Else GUICtrlSetColor($sec_lbls[@SEC - 1], 0x000000) EndIf GUICtrlSetColor($sec_lbls[@SEC], $sec_color) EndIf EndSelect WEnd Exit Edited November 14, 2005 by gafrost SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
Koder Posted November 14, 2005 Posted November 14, 2005 It looks like it rapidly creates new label controls as a 'second hand'. I'm afraid to run this, I only have 2 gigabytes of ram Maybe drawing pixels would consume less memory.... Yep, memory usage goes up like crazy, pixels are cheaper but I don't know how to make them stick (they get painted over and disappear).
Lazycat Posted November 14, 2005 Posted November 14, 2005 It looks like it rapidly creates new label controls as a 'second hand'. I'm afraid to run this, I only have 2 gigabytes of ram Maybe drawing pixels would consume less memory.... Yep, memory usage goes up like crazy, pixels are cheaper but I don't know how to make them stick (they get painted over and disappear).Don't worry about memory - it's crash far before due Autoit controls limit Nice looking app anyway. Koda homepage ([s]Outdated Koda homepage[/s]) (Bug Tracker)My Autoit script page ([s]Outdated mirror[/s])
GaryFrost Posted November 14, 2005 Posted November 14, 2005 Don't worry about memory - it's crash far before due Autoit controls limit Nice looking app anyway. shouldn't crash now, forgot to put the condition in. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference.
busysignal Posted November 18, 2005 Posted November 18, 2005 Nice example and great job for your first post.. Cheers..
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