Jump to content

Why does this not work? multiple clock times in statment

Recommended Posts

  • Developers

Because this is not doing what you assume it is doing. It will resolve $h as true first when doing "18 or 20 or 22" and then you compare @hour with true.

Run this in Scite and look at the output pane for the result.

$h = 18 or 20 or 22
ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $h = ' & $h & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
Edited by 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 post
Share on other sites

It took me a long time before I finally figured out that I could group If statements like mathematical statements (to an extent), for example:

If (@HOUR = 18 Or @HOUR = 20 Or @HOUR = 22) And (@MIN = 15 Or @MIN = 30 Or @MIN = 45) And (@SEC = 00 Or @SEC = 30) Then

This If statement will become true in 18 different ways - which should be what you are wanting. It's amazing what specific things you can filter when you group If statements in parenthesis. According to the help file:

The expression can contain the boolean operators of AND, OR, and NOT as well as the logical operators <, <=, >, >=, =, ==, and <> grouped with parentheses as needed.

- Fett

Edited by fett8802
[sub]My UDF[/sub][sub] - Basics and Time extensions. Great for those new at AutoIt, also contains some powerful time extensions for pros.[/sub][sub]ScrabbleIt[/sub][sub] - Scrabble done in pure AutoIt. (In Progress)[/sub][sub]Nerd Party Extreme | My Portfolio | [email="fett8802@gmail.com"]Contact Me[/email][/sub]
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...