Jump to content

Small script to notify me when is a particular time


Recommended Posts

I'm new to AutoIt.

I tried to make a small script to notify me when is a particular time:

Local $sTime = @HOUR & ":" & @MIN & ":" & @SEC
While 1
    If @HOUR = 14 & @MIN = 35 & @SEC = 00 then
        MsgBox(0,"",@HOUR&"h "&@MIN&"m "&@SEC&"s",10)
        Do
            Sleep(random(1, 10, 1))
        Until @HOUR <> 14 & @MIN <> 35 & @SEC <> 00

    ElseIf @HOUR = 14 & @MIN = 37 & @SEC = 00 then
        MsgBox(0,"",@HOUR&"h "&@MIN&"m "&@SEC&"s",10)
        Do
            Sleep(random(1, 10, 1))
        Until @HOUR <> 14 & @MIN <> 37 & @SEC <> 00

    ElseIf @HOUR = 14 & @MIN = 39 & @SEC = 00 then
        MsgBox(0,"",@HOUR&"h "&@MIN&"m "&@SEC&"s",10)
        Do
            Sleep(random(1, 10, 1))
        Until @HOUR <> 14 & @MIN <> 39 & @SEC <> 00

    Endif
    Sleep(random(1, 10, 1))
Wend

I want this script to start when I log into Windows and stops when out of Windows.

Unfortunately,this script not notice me at all, such I introduced in my script.

How and where is my mistake?

Thanks a lot for any advice

Link to comment
Share on other sites

  • Developers

The And relation in If statements is not & but And.

Local $sTime = @HOUR & ":" & @MIN & ":" & @SEC
While 1
    If @HOUR = 14 And @MIN = 35 And @SEC = 00 Then
        MsgBox(0, "", @HOUR & "h " & @MIN & "m " & @SEC & "s", 10)
        Sleep(1500)
    ElseIf @HOUR = 14 And @MIN = 37 And @SEC = 00 Then
        MsgBox(0, "", @HOUR & "h " & @MIN & "m " & @SEC & "s", 10)
        Sleep(1500)
    ElseIf @HOUR = 14 And @MIN = 39 And @SEC = 00 Then
        MsgBox(0, "", @HOUR & "h " & @MIN & "m " & @SEC & "s", 10)
        Sleep(1500)
    EndIf
    Sleep(500)
WEnd

Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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