Jump to content

cRAzY cLoCk


Valuater
 Share

Recommended Posts

Need some testers.... please

... sometimes, you can actually tell the time... lol

*** You can Click And Drag the First Number to anywhere you want, then all the numbers will follow AND the Animated actions will Stop, Click and move the first number again and the Animation will resume. ***

;********* USER INPUT **************
; Create a Background GUI?
Dim $BackGround_GUI = False
; Animation on?
Dim $Random = True
; Display 6= minutes, 3 = +seconds, 0 = +am/pm
Dim $dView = 6
; seconds to wait between animations
$wMin = 1
$wMax = 10
Dim $wait = Random($wMin, $wMax, 1)
; Font Size ; -1 = random 38-50
Dim $tSize = -1
;********** END USER INPUT ***********

#include <FreeText.au3>
#include <Date.au3>

; FreeText. au3 - cRAzY cLoCk - Desk-Top System Time
$FT_Ver = "Ver 2.5.2 " ; 11/24/2008,  AutoIt Ver 3.2.12.0"

Opt("GUIOnEventMode", 1)

Global $Time_hold = 1, $Time_GUI[2][2], $ticks = TimerInit(), $Clock_is_set = False

_FreeText_Functions()

HotKeySet("{ESC}", "_Terminate")

If $BackGround_GUI = True Then $GUI_Back = _FreeText_CreateBackGround()

While 1
    $dif = Int(TimerDiff($ticks) / 1000)
    
    If $Random And $dif >= $wait Then
        $uPick = Random(1, 28, 1)
        ConsoleWrite("> Case = " & $uPick & @CRLF)
        $nSize = _Pick_Text_Size()
        $cColor = _Pick_a_Color()
        Switch $uPick
            Case 1
                _FreeText_CreateGlitter("Random", 100, 4000, 1, 1)
            Case 2, 28
                $style = _Pick_a_Color("0,2,4,6,8,10,12,14,16,18");1,3,5,7,9,11,13,15,17,19")
                _FreeText_Animate($Time_GUI, $style)
                Sleep(500)
                _FreeText_Animate($Time_GUI, $style + 1)
            Case 3
                _FreeText_Blink($Time_GUI)
            Case 4
                _FreeText_Bump($Time_GUI)
            Case 5
                _FreeText_ColorStrobe($Time_GUI)
            Case 6
                _FreeText_HorseRace($Time_GUI)
            Case 7
                _FreeText_FireWorks($Time_GUI)
                $Clock_is_set = False
            Case 8
                _FreeText_Implode($Time_GUI)
            Case 9
                _FreeText_MixUp($Time_GUI)
                _FreeText_Shape_SetTextColor($Time_GUI, _Pick_a_Color())
                _FreeText_Scatter($Time_GUI)
                _FreeText_Move($Time_GUI, 100, 510)
            Case 10, 25
                _FreeText_Move($Time_GUI, 10, 10)
            Case 11
                _FreeText_MoveAsIs($Time_GUI, 200, 325)
            Case 12
                For $x = 1 To UBound($Time_GUI) - 1
                    _FreeText_ExplodeOne($Time_GUI)
                Next
                $Clock_is_set = False
            Case 13, 26
                _FreeText_MoveVertical($Time_GUI, 10, 10)
            Case 14
                _FreeText_Rain($Time_GUI)
            Case 15
                _FreeText_Rainbow($Time_GUI)
            Case 16
                _FreeText_Scatter($Time_GUI)
            Case 17
                _FreeText_Shape_ClearText($Time_GUI)
            Case 18
                _FreeText_Shape_RainbowText($Time_GUI)
            Case 19
                _FreeText_Shape_SetTextColor($Time_GUI, _Pick_a_Color())
            Case 20
                _FreeText_Shape_StrobeText($Time_GUI)
            Case 21
                _FreeText_ShockWave($Time_GUI)
            Case 22
                _FreeText_SpinIn($Time_GUI)
                $Clock_is_set = False
            Case 23
                _FreeText_SpinOut($Time_GUI)
                $Clock_is_set = False
            Case 24
                _FreeText_StairCase($Time_GUI)
            Case 27
                _FreeText_Delete($Time_GUI)
                $Clock_is_set = False
        EndSwitch
        $wait = Random($wMin, $wMax, 1)
        $ticks = TimerInit()
    EndIf
    
    $Time = StringTrimRight(_Now(), $dView)
    If $Clock_is_set Then
        If StringLen($Time) <> $Time_hold Then
            $Time_hold = StringLen($Time)
            $GUI_Pos = _FreeText_GetPosition($Time_GUI)
            _FreeText_Delete($Time_GUI)
            $Time_GUI = _FreeText_Creator($Time_hold)
        Else
            _FreeText_Shape_SetText_Special($Time_GUI, $Time)
        EndIf
    Else
        $Clock_is_set = True
        $Time_hold = StringLen($Time)
        If $BackGround_GUI = True Then
            GUIDelete($GUI_Back)
            $GUI_Back = _FreeText_CreateBackGround()
        EndIf
        $Time_GUI = _FreeText_Creator($Time_hold)
    EndIf
    Sleep(20)
WEnd

Func _Set_Animation()
    $pos = WinGetPos($Time_GUI[1][0])
    _FreeText_Move($Time_GUI, $pos[0], $pos[1])
    $Random = Not $Random
    ToolTip("Animation = " & $Random & @CRLF & "Press (esc) to exit   ", 20, 20, "  cRAzY cLoCk... 8)  ", 1)
    Sleep(4000)
    ToolTip("")
EndFunc   ;==>_Set_Animation

Func _Terminate()
    Exit 0
EndFunc   ;==>_Terminate

Func _FreeText_Creator($a1)
    $nSize = _Pick_Text_Size()
    $cColor = _Pick_a_Color()
    $a2 = Random(1, 3, 1)
    If $a2 = 1 Then Return _FreeText_CreateBalls($a1, -1, -1, $nSize, $cColor)
    If $a2 = 2 Then Return _FreeText_CreateBlocks($a1, -1, -1, $nSize, $cColor)
    If $a2 = 3 Then Return _FreeText_CreateCubes($a1, -1, -1, $nSize, $cColor)
EndFunc   ;==>_FreeText_Creator

Func _Pick_Text_Size()
    If $tSize = -1 Then Return Random(30 + $dView, 34 + $dView, 1)
    Return $tSize
EndFunc   ;==>_Pick_Text_Size

Func _Pick_a_Color($cChoices = "Red,Green,Blue,Black,White,yellow,violet,win_xp_bg")
    $cSplit = StringSplit($cChoices, ",")
    $cRand = Random(1, $cSplit[0], 1)
    Return $cSplit[$cRand]
EndFunc   ;==>_Pick_a_Color

Func _FreeText_Shape_SetText_Special($B_GUI, $Text, $Size = 20, $Color = "black", $Font = "Arial", $Weight = 1000, $delay = 20)
    If Not IsArray($B_GUI) Then Return 0
    Local $TL_S = StringSplit($Text, ""), $tControl, $Tpos, $ret, $rgn
    If UBound($TL_S) > UBound($B_GUI) Then Return 0
    If StringIsXDigit($Color) = 0 Then $Color = _GetColorByName($Color)
    For $x = 1 To $TL_S[0]
        Sleep($delay)
        GUICtrlSetData($B_GUI[$x][1], $TL_S[$x])
        If $x = 1 Then
            GUICtrlSetStyle($B_GUI[$x][1], -1, $GUI_WS_EX_PARENTDRAG)
            GUICtrlSetOnEvent($B_GUI[$x][1], "_Set_Animation")
        EndIf
        GUICtrlSetColor($B_GUI[$x][1], $Color)
        GUICtrlSetFont($B_GUI[$x][1], $Size, $Weight, "", $Font)
    Next
    Return 1
EndFunc   ;==>_FreeText_Shape_SetText_Special

Requires FreeText.au3 Ver 2.5.0 from here.....

http://www.autoitscript.com/forum/index.ph...st&p=527912

Enjoy!!!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Thanks FireStorm

lol nice

but when it starts to scramble it deselects my window.

Well it's almost more of a Screen Saver... But, I forgot an Important part, a very important part

*** You can Click And Drag the First Number to anywhere you want, then all the numbers will follow AND the Animated actions will Stop, Click and move the first number again and the Animation will resume. ***

But, Please report any errors or problems too!

8)

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

Thanks FireStorm

Well it's almost more of a Screen Saver... But, I forgot an Important part, a very important part

*** You can Click And Drag the First Number to anywhere you want, then all the numbers will follow AND the Animated actions will Stop, Click and move the first number again and the Animation will resume. ***

But, Please report any errors or problems too!

8)

That's really crazy!

Very nice Valuater.

A few problems I found.

The initial background colour can be black and then the appearance is just a lot of black blocks moving around for a while.

When the background is a circle for each number the numbers are too high in the circles and the tops are cut off.

If you drag the first number to a new position it might be better if it moved to the right if needed to fit all the number in rather than have some off the screen.

Maybe add minutes.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

That's really crazy!

Very nice Valuater.

A few problems I found.

The initial background colour can be black and then the appearance is just a lot of black blocks moving around for a while.

When the background is a circle for each number the numbers are too high in the circles and the tops are cut off.

If you drag the first number to a new position it might be better if it moved to the right if needed to fit all the number in rather than have some off the screen.

Maybe add minutes.

Thanks martin....

Yea, I noticed the text color at times matched the background color, I just thought of that as part of the crazy... I will think about that some more ""... sometimes, you can actually tell the time... lol""

( I have to consider all FeeText. au3 uses )

*

The circles will be fixed in the updated FreeText.au3 when I finish this post ( $FT_Ver = "Ver 2.5.2 " )

*

I was thinking that the use might want to get it off-screen for his uses, so I didn't make it stay On-Screen

*

It already shows the minutes...but the seconds an AM/PM can be displayed also, I will make a user input for that

Thanks again!!!

8)

NEWHeader1.png

Link to comment
Share on other sites

  • Moderators

Geeze ... all this wasted talent ... someone bottle it up for me!

Nice work Robert.. it's a bit flickery here ... and the numbers were cut off a bit with the smaller circles (think martin covered that), but it certainly opens the mind to other possibilities.

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Thanks martin....

....

It already shows the minutes...

8)

Not for me, it just shows the hour

28/11/2008 07

But if I have

$Time = _Now()
$Time = StringTrimRight($Time,StringLen($Time) - stringinstr($Time,':',0,-1) + 1)

Then it shows me the minutes as well.

EDIT:

If the time is set for 24 hour format then there is no am or pm attached, so something like this?

$Time = _Now()
If StringRegExp($Time, ("am|pm")) Then
    $dView24 = $dView
Else
    If $dView > 0 Then
        $dView24 = $dView - 3
    Else
        $dView24 = $dView
    EndIf
    
EndIf

$Time = StringTrimRight($Time, $dView24)
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

@martin

from the revised 1st Script after your constructive post. I changed the "view" values to this...

; Display 6= minutes, 3 = +seconds, 0 = +am/pm

$dView = 6

that works on this portion...

$Time = StringTrimRight(_Now(), $dView)

Can't you adjust this to your needs ( I would think the display and length would be the same for english...??? )

Thanks

8)

EDIT... just noted that $dView was not globalized... fixed now

Edited by Valuater

NEWHeader1.png

Link to comment
Share on other sites

@martin

from the revised 1st Script after your constructive post. I changed the "view" values to this...

; Display 6= minutes, 3 = +seconds, 0 = +am/pm

$dView = 6

that works on this portion...

$Time = StringTrimRight(_Now(), $dView)

Can't you adjust this to your needs ( I would think the display and length would be the same for english...??? )

Thanks

8)

EDIT... just noted that $dView was not globalized... fixed now

Doesn't work but unless I'm missing something then I think you are :).

It's nothing to do with being English (although I admit that does cause a lot of problems).

My time is set for 24 hrs as I said in my last post. So taking away the last 6 characters removes the minutes and the seconds.

I assume your clock is set to 12 hours with am or pm attached, so removing the last 6 characters removes am and the seconds.

I showed in my previous post two ways that fix it.

You could also use

$24HourClock = RegRead("HKEY_CURRENT_USER\Control Panel\International","iTime") = 1

to decide what format the time is in.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...