Sign in to follow this  
Followers 0
BillMelater

Clock, quick and dirty

8 posts in this topic

#1 ·  Posted (edited)

Needed a big clock to ride on top of a specialty program that lacked one.  This runs in a fixed space on one computer only.  everything is hard coded because of my inexperience and it's just for me. 

Not cleaned up, probably hogging memory, but I have about one hour a day to slap together needed interface elements to a very complex program that is lacking them.  Got more includes than needed, cut and paste of other script examples,  and comments that have nothing to do with the script, but it works.  I'm not a programmer, but I did stay in a Holiday Inn Express® last nite.  If it works, screw it, on to the next fire.  Runs on a different box than the one coded on with no issues, although in the wrong X, Y.

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.3.8.1
 Author:         myName

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

; Script Start - Add your code below here
;Local $sDestination = ("d:\buttons\premiereon.gif")

#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>

;ProcessClose ("deck1.exe")
if _Singleton("time",1) = 0 Then
    ;Msgbox(0,"Warning","An occurence of test is already running")
  Exit

EndIf


;ControlSetText("statusdeck", "", 18, $Status)
GUICreate("time", 416, 92, 28, 752,  BitOR($WS_SYSMENU,$WS_POPUP), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
GUISetBkColor(0xFFFFFF)
GUICtrlCreateLabel("Label1",  0, 15, 415, 90,  BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 48, 800, 0, "Segoe UI")
 GUICtrlCreateLabel("Label2", 101, 0, 215, 21, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")

WinSetTrans("time", "", 200)
GUISetState(@SW_SHOW)

;SETS BOTTOM STATUS BAR TO SHOW RECORD TIME FOR GNN NEWS
Local $sDayname = _DateDayOfWeek(@WDAY , $DMW_LOCALE_LONGNAME )
Local $sMonth =  _DateToMonth(@MON, $DMW_LOCALE_LONGNAME)
Local $sDayNum =  _DateToDayValue(@YEAR, @MON, @MDAY)
$sDayNum = StringMid($sDayNum, 1 , 2 )
Local $sYear = @Year
While 1
Local $sDayname = _DateDayOfWeek(@WDAY , $DMW_LOCALE_LONGNAME )
Local $sMonth =  _DateToMonth(@MON, $DMW_LOCALE_LONGNAME)
Local $sDayNum =  @MDAY
;$sDayNum = StringMid($sDayNum, 1 , 2 )
Local $sYear = @Year
ControlSetText("time", "", 3,  _NowTime(5))
ControlSetText("time", "", 4, $sDayname & ", " & $sMonth & " " & $sDayNum & ", " & $sYear)

Sleep(999)
;ControlSetText("statusdeck", "", 19, "")
;ControlSetText("time", "", 3,  _NowTime(5))
Wend
Edited by BillMelater

Share this post


Link to post
Share on other sites



Nice.  Reminded me of an old clock/toy >I made once...so I added some color.

#cs ----------------------------------------------------------------------------
 AutoIt Version: 3.3.8.1
 Author:         myName
 Script Function:
    Template AutoIt script.
#ce ----------------------------------------------------------------------------
; Script Start - Add your code below here
;Local $sDestination = ("d:\buttons\premiereon.gif")
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <Constants.au3>
#include <Misc.au3>
#include <MsgBoxConstants.au3>
#include <Date.au3>
;ProcessClose ("deck1.exe")
if _Singleton("time",1) = 0 Then
    ;Msgbox(0,"Warning","An occurence of test is already running")
  Exit
EndIf

Global $updatetimer = TimerInit(), $blendtimer = 10000
Global $varColors[3], $varBlendRates[3], $varBlendDirections[3]
PaintRand()
;ControlSetText("statusdeck", "", 18, $Status)
$gui = GUICreate("time", 416, 92, 28, 752,  BitOR($WS_SYSMENU,$WS_POPUP), BitOR($WS_EX_TOOLWINDOW,$WS_EX_TOPMOST))
GUISetBkColor(0xFFFFFF)
GUICtrlCreateLabel("Label1",  0, 15, 415, 90,  BitOR($SS_CENTER,$SS_CENTERIMAGE))
GUICtrlSetFont(-1, 48, 800, 0, "Segoe UI")
 GUICtrlCreateLabel("Label2", 101, 0, 215, 21, $SS_CENTER)
GUICtrlSetFont(-1, 12, 400, 0, "Segoe UI")
WinSetTrans("time", "", 200)
GUISetState(@SW_SHOW)
;SETS BOTTOM STATUS BAR TO SHOW RECORD TIME FOR GNN NEWS
Local $sDayname = _DateDayOfWeek(@WDAY , $DMW_LOCALE_LONGNAME )
Local $sMonth =  _DateToMonth(@MON, $DMW_LOCALE_LONGNAME)
Local $sDayNum =  _DateToDayValue(@YEAR, @MON, @MDAY)
$sDayNum = StringMid($sDayNum, 1 , 2 )
Local $sYear = @Year
While 1
Local $sDayname = _DateDayOfWeek(@WDAY , $DMW_LOCALE_LONGNAME )
Local $sMonth =  _DateToMonth(@MON, $DMW_LOCALE_LONGNAME)
Local $sDayNum =  @MDAY
;$sDayNum = StringMid($sDayNum, 1 , 2 )
Local $sYear = @Year
ControlSetText("time", "", 3,  _NowTime(5))
ControlSetText("time", "", 4, $sDayname & ", " & $sMonth & " " & $sDayNum & ", " & $sYear)
GUISetBkColor(Colorize())
Sleep(90)
;ControlSetText("statusdeck", "", 19, "")
;ControlSetText("time", "", 3,  _NowTime(5))
Wend

Func PaintBlend()
    If TimerDiff($blendtimer) > 10000 Then
        $blendtimer = TimerInit()
        BlendRates()
    EndIf
    For $i = 0 to 2
        BlendColors($varColors[$i],$varBlendRates[$i],$varBlendDirections[$i])
    Next
EndFunc
Func PaintRand()
    SRandom(Random(1,200))
    For $i = 0 to 2
        $varColors[$i] = Hex(Random(0,255,1),2)
    Next
EndFunc
Func BlendRates()
    For $i = 0 to 2
        $varBlendDirections[$i] = Random(0,1,1)
        $varBlendRates[$i] = Random(3,10,1)
    Next
EndFunc
Func BlendColors(byref $varThisColor,$varBlendRate,byref $varBlendDir)
    If $varBlendDir = 1 Then
        $varThisColor += $varBlendRate
    Else
        $varThisColor -= $varBlendRate
    EndIf
    If $varThisColor > 255 Then
        $varThisColor -= $varBlendRate
        $varBlendDir = 0
    EndIf
        If $varThisColor < 0 Then
        $varThisColor += $varBlendRate
        $varBlendDir = 1
    EndIf
EndFunc
Func Colorize()
    PaintBlend()
    $varColor = "0x"
    For $i = 0 to 2
       $varColor &= Hex(Int($varColors[$i]),2)
    Next
    Return $varColor
 EndFunc

Share this post


Link to post
Share on other sites

Share this post


Link to post
Share on other sites

"I'm not a programmer, but I did stay in a Holiday Inn Express® last nite."

 

Booking in - Are you a programmer Sir?

No, but can I throw something together that will work in Autoit.

Very well Sir, you will be allowed to stay. :D


2015 - Still no flying cars, instead blankets with sleeves.

Share this post


Link to post
Share on other sites

Uh, why not determine the day every second?  Quick and Dirty and etc.  I don't know, tell me why not.   ...it works for me.

Share this post


Link to post
Share on other sites

#8 ·  Posted (edited)

/CSB Time.  I work with a DOS 6.22 Based Radio Automation Program running on Win 98.  Last programmed version 2005.  It does backups to a redundant harddrive.  6 years ago, lightning destroyed the system, leaving only the backup.  We were able to move our backup hardware in, but when you put the backup drive in (after cloning it, to have another backup), the colors were horrible (for DOS) and a warning about contacting the company (no longer in bitnezz) on the screen.  After much wailing and gnashing, and finger pointing as to why Lightning hit us (300 foot tower with transmitters on site, duh)  I was able to determine the Volume Label of the Dos Drive that wasn't the backup was whateverPRIMARY, and the backup was whateverBACKUP.   Hmm.  Lets change the volume label of the backup.  Ding Ding Ding.  Never, Never ever underestimate quick and dirty.  Actually, it usually wins.

 

Edited by BillMelater
better example

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