Jump to content
Sign in to follow this  
alan lim

Expression

Recommended Posts

alan lim

I have read through the help file and understand that there are only two operation,

( OR and AND )

If $var = 5 AND $var2 > 6 Then

If $var = 5 OR $var2 > 6 Then

I want to use 'ANY operator'. Example if my value has 1,3,5,7. I want to use If <expression> Then statement. Is there anyway to use ANY operator. If my input is 5 then it will go to next line. Instead of input must be 1,3,5,7. Thankyou

Share this post


Link to post
Share on other sites
jpm

I have read through the help file and understand that there are only two operation,

( OR and AND )

If $var = 5 AND $var2 > 6 Then   

If $var = 5 OR $var2 > 6 Then 

I want to use 'ANY operator'. Example if my value has 1,3,5,7.  I want to use If <expression> Then statement. Is there anyway to use ANY operator. If my input is 5 then it will go to next line. Instead of input must be 1,3,5,7. Thankyou

There is no ANY operator in AutoIt3, so you need to code it yourself one checking at a time.

Or you can use StringInStr("1!3!5!7!",string($n) & "!").

This will return true if $n =1 3 5 or 7

:D

Share this post


Link to post
Share on other sites
ezzetabi

:D

Why not

If $n = 1 or $n = 3 or $n = 5 or $n = 7 Then MsgBox(0,"","GREAT")

?

Share this post


Link to post
Share on other sites
Gene

:D

Why not

If $n = 1 or $n = 3 or $n = 5 or $n = 7 Then MsgBox(0,"","GREAT")

?

If you code either solutions given to you as a User Defined Function, aka UDF, then you can call it ANY(value, choicelist), and use it in any code you write. If you haven't already read about UDFs in the Help file, do so, they aren't difficult.

Gene


[font="Verdana"]Thanks for the response.Gene[/font]Yes, I know the punctuation is not right...

Share this post


Link to post
Share on other sites
alan lim

I like to thank you peoples have gave me those advise.

Thankyou very much. :D

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.