Sign in to follow this  
Followers 0
krp

multiple AND OR operators please help thanks.

4 posts in this topic

#1 ·  Posted (edited)

Hi,

So I have this.

I want to search for multiple pixel colors in the same area using several AND OR logical operators 

Though I get (Error: Error in expression) when I run the script

(I have spaced out the code with lots of white space so its better to see what i'm doing)

Thanks,

Func func_name()

    Local $i = 0
    While $i <= 1
        
                $var1 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color1, 10, 0) 
                And 
                $var2 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color2, 10, 0) 
                
                Or
        
                $var3 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color3, 10, 0) 
                And 
                $var4 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color4, 10, 0)

                or

                $var5 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color5, 10, 0)
                And
                $var6 = PixelSearch($ga_x1, $ga_y1, $ga_x2, $ga_y2, $color6, 10, 0)
        
                if not @error Then
                        Call("some_function")
                Else
                        ToolTip("Didn't find anything etc...",2,0)
                EndIf

    $i = $i + 1
    WEnd
EndFunc
Edited by krp

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Probably a multi line issue.

here is basic example how to do it properly.

While 1 _ ;Multi line
        And 2 _ ;Multi line
        And 3 ;End of expression
    Sleep(1000)
    ConsoleWrite("Invalid URL" & @CRLF)
WEnd
Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Share this post


Link to post
Share on other sites

Thanks, got it working.

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  
Followers 0