Jump to content

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)
GUISetState()
While 1
    $msg = GUIGetMsg()
    If $msg = -3 Then
        ExitLoop
    ElseIf $sec <> @SEC Then
        GUICtrlSetData($clocklabel, TimeSet())
        AlarmCheck(TimeSet())
    EndIf
WEnd
Exit
Func AlarmCheck($time)
;Alarm function(configure how wanted)
EndFunc ;==>AlarmCheck
Func Close()
    Exit
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"
    EndIf
    $time = $hour & ":" & $minute & ":" & $sec & $light
    Return $time
EndFunc ;==>TimeSet
Link to comment
Share on other sites

  • Moderators

Or:

$Timer = TimerInit()
Do
;script
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.

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