Vegar Posted February 14, 2012 Share Posted February 14, 2012 $h = 18 or 20 or 22 $m = 15 or 30 or 45 $S = 00 or 30 While 1 If @hour=$h and @min=$m and @sec=$s Then sleep (1000) _somefunc() Else Sleep(10) EndIf Wend Func _somefunc() MsgBox(0,"",@HOUR&"h "&@MIN&"m "&@SEC&"s "&@msec&"ms") EndFunc hmm Link to comment Share on other sites More sharing options...
Developers Jos Posted February 14, 2012 Developers Share Posted February 14, 2012 (edited) 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 February 14, 2012 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 comment Share on other sites More sharing options...
Vegar Posted February 14, 2012 Author Share Posted February 14, 2012 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 Link to comment Share on other sites More sharing options...
fett8802 Posted February 14, 2012 Share Posted February 14, 2012 (edited) 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 February 14, 2012 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 comment Share on other sites More sharing options...
Vegar Posted February 14, 2012 Author Share Posted February 14, 2012 Superb, worked perfect, Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now