Jump to content
Sign in to follow this  
Vegar

Why does this not work? multiple clock times in statment

Recommended Posts

Jos

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Vegar

hmm, yeah i see ... "@@ Debug(5) : $h = True"

But what is the best/ easyest solution to this? ..

sorry, i have'nt been scripting for a while :)

Share this post


Link to post
Share on other sites
fett8802

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]

Share this post


Link to post
Share on other sites
Vegar

Superb, worked perfect, Thank you! :)

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  

×