Jump to content
Sign in to follow this  

Clock help!

Recommended Posts


Ok, I have a clock for autoit and I need it to stay on the screen for 15 seconds, then move on to another command. Right now it will keep looping. Please help! Thanks!

The clock:

Global $sec = @SEC, $minute, $hour, $light, $time, $clocklabel
opt("WinWaitDelay", 100)
opt("WinTitleMatchMode", 4)
opt("WinDetectHiddenText", 1)
opt("MouseCoordMode", 0)
GUICreate("Max's Clock", 200, 50, (@DesktopWidth - 188) / 2, (@DesktopHeight - 59) / 2)
$clocklabel = GUICtrlCreateLabel("Loading...", 5, 5, 190, 40, 0x1000)
GUICtrlSetFont($clocklabel, 24)
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then
    ElseIf $sec <> @SEC Then
        GUICtrlSetData($clocklabel, TimeSet())
Func AlarmCheck($time)
;Alarm function(configure how wanted)
EndFunc ;==>AlarmCheck
Func Close()
EndFunc ;==>Close
Func TimeSet()
    $light = " AM"
    $hour = @HOUR
    $minute = @MIN
    $sec = @SEC
    If $hour = 0 Then
        $hour = 12
    ElseIf $hour = 12 Then
        $light = " PM"
    ElseIf $hour > 12 Then
        $hour = (@HOUR) - 12
        $light = " PM"
    $time = $hour & ":" & $minute & ":" & $sec & $light
    Return $time
EndFunc ;==>TimeSet

Share this post

Link to post
Share on other sites

Sleep(15000) do the job?

Share this post

Link to post
Share on other sites


$Timer = TimerInit()
Until TimerDiff($Timer) / 1000 >= 15

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.

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