Sign in to follow this  
Followers 0
SBrix

Need help with imagesearch

4 posts in this topic

Hi guys :)

I was wondering, if there was a function that allowed me to search for two seperate images in one code?

My code looks like this:

$search = _imagesearch('1pixel.bmp', 0, $x, $y, 0)

So is there a function that allows me to do this (Not a real code, but I think you get the point):

$search = _imagesearch('1pixel.bmp + 2pixel.bmp', 0, $x, $y, 0)

 

Share this post


Link to post
Share on other sites



why would you want that? 

It could be something like below (not tested)

Example()

Func Example()
    ; Sample scriptusing @NumParams macro
    _MySearch("1pixel.bmp", "2pixel.bmp")
EndFunc   ;==>Example

Func _MySearch($v1 = 0, $v2 = 0, $v3 = 0, $v4 = 0, $v5 = 0, $v6 = 0, $v7 = 0, $v8 = 0, $v9 = 0, _
        $v10 = 0, $v11 = 0, $v12 = 0, $v13 = 0, $v14 = 0, $v15 = 0, $v16 = 0, $v17 = 0, $v18 = 0, $v19 = 0)
    #forceref $v1, $v2, $v3, $v4, $v5, $v6, $v7, $v8, $v9, $v10, $v11, $v12, $v13, $v14, $v15, $v16, $v17, $v18, $v19
    Local $search = true
    For $i = 1 To @NumParams
        $search =_imagesearch(Eval("v" & $i), 0, $x, $y, 0)
        if $search=false then return 0
    Next
    
EndFunc

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Hi,

if you mean what I think you mean, you would need to set up your search function (_imagesearch) in a loop.

Even if you are only going to call it twice... :graduated:

Edit: I have been told I oversimplify things but here is a crude example:

$j = 2 ; How many times we want to loop through this function)

For $i = 1 To $j ; your loop calling your function twice

    _imagesearch() ; you can set this part up to add "1" to your bmp name each time (  $i & 'pixel.bmp'  )
    $i + 1
Next


Func _imagesearch() ; The only thing this funtion does is call a MsgBox for testing purposes

    MsgBox(0, "img srch", "Found bmp number:  " & $i)

EndFunc   ;==>_imagesearch
Edited by l3ill

Share this post


Link to post
Share on other sites

I figured a way around the problem. Thanks for the help :)

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