Jump to content

Manual Clock


DaProgrammer
 Share

Recommended Posts

If u need to have a 20 second minute or a 10 hour day than u can use this:

just set up your "$Max" Values u need and enjoy imbedding it to your apps.

$MaxSeconds = 3
$MaxMinutes = 5
$MaxHours = 3

$Seconds = 0
$Minutes = 0
$Hours = 0
$days = 0

GuiCreate("Manual Clock", 100, 50)
$Label = GuiCtrlCreateLabel($days & " : " & $Hours & " : " & $Minutes & " : " & $Seconds, 10, 10, 80, 30,0x01)
GuiSetState()

While 1
W8forSec()
$Seconds = $Seconds + 1
If $Seconds = $MaxSeconds Then
    $Minutes = $Minutes +1
    $Seconds = 0
    If $Minutes = $MaxMinutes Then
        $Hours = $Hours + 1
        $Minutes = 0
        If $Hours = $MaxHours Then
            $days = $days + 1
            $Hours = 0
            If $Hours = $MaxHours Then
                $days = $days + 1
                $Hours = 0
            EndIf
        EndIf
    EndIf
EndIf
GUICtrlSetData($Label,$days & " : " & $Hours & " : " & $Minutes & " : " & $Seconds)
WEnd

Func W8forSec()
    $Time = @SEC
    While @SEC = $Time
        Sleep(50)
    WEnd
EndFunc
Link to comment
Share on other sites

Well if i ever need a 20 second minute or a 10 hour day I'll know where to come...

:)

Might want to make the gui on event mode for exiting.

My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop.
Link to comment
Share on other sites

$MaxSeconds = 3
$MaxMinutes = 3
$MaxHours = 3

$Seconds = 0
$Minutes = 0
$Hours = 0
$days = 0

GuiCreate("Manual Clock", 100, 50)
$Label = GuiCtrlCreateLabel($days & " : " & $Hours & " : " & $Minutes & " : " & $Seconds, 10, 10, 80, 30,0x01)
GuiSetState()

$Time = TimerInit()

While 1
$Seconds = Int(TimerDiff($Time)/1000) - $Minutes*$MaxSeconds - $Hours*$MaxMinutes*$MaxSeconds - $days*$MaxHours*$MaxMinutes*$MaxSeconds
If $Seconds = $MaxSeconds Then
    $Minutes = $Minutes +1
    $Seconds = $Seconds - $MaxSeconds
    If $Minutes = $MaxMinutes Then
        $Hours = $Hours + 1
        $Minutes = $Minutes - $MaxMinutes
        If $Hours = $MaxHours Then
            $days = $days + 1
            $Hours = $Hours - $MaxHours
        EndIf
    EndIf
EndIf

GUICtrlSetData($Label,$days & " : " & $Hours & " : " & $Minutes & " : " & $Seconds)
Sleep(250)
WEnd

same idea only based on timer instead of PC-Clock

choose whatever works best for you

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...