Jump to content

Recommended Posts

Posted (edited)

I downloaded: https://www.autoitscript.com/forum/files/file/471-image-search-udf/

I have also added #include "_ImageSearch.au3" and "_ImageSearchDebug.au3" to my script.

My script its in the same folder of _ImageSearcha.au3,_ImageSearchDebug.au3 (with dll files etc.)

Every time I try to run my script I get: Line48 Error: Unknown function name.

While(_ImageSearch(Seach_1.bmp, 0) And _ImageSearch(Seach_2.bmp, 0) <> True)
   Sleep(100)
WEnd ;Sleep until you see this 2 image
If(_ImageSearch(Seach_1.bmp, 0) And _ImageSearch(Seach_2.bmp, 0) = True)Then

 

Edited by Zag8888
Posted
  On 4/13/2019 at 12:18 PM, Jos said:

Where is your #include<> statement to add the imagesearch UDF's?

JOs

Expand  

Hey, I should type #include< _ImageSearch.au3 > and < _ImageSearchDebug.au3 > instead of ""? Whats the difference?

Posted (edited)

well your code is badly formatted...replace loop with :

Local $pos1, $pos2
While True
  $pos1 = _ImageSearch("Seach_1.bmp")
  if not $pos1[0] then ContinueLoop
  $pos2 = _ImageSearch("Seach_2.bmp")
  if $pos2[0] then ExitLoop
  Sleep(100)
WEnd ;Sleep until you see this 2 image

Your bmp where not included in quotes, and return value is an array.   Please read carfully the headers of the functions.

I just realized that the "no match" is not an @error but 0 in array[0]

Edited by Nine
Posted
  On 4/13/2019 at 12:24 PM, Jos said:

No idea what you are asking me, but the posted code does not contain an #include<>.

As to the syntax of #include, I refer you to the helpfile.

Jos

Expand  

I have fixed this, and now it work!

Posted
  On 4/13/2019 at 12:22 PM, Nine said:

well your code is badly formatted...replace loop with :

Local $pos1, $pos2
While True
  $pos1 = _ImageSearch("Seach_1.bmp")
  if @error then ContinueLoop
  $pos2 = _ImageSearch("Seach_2.bmp")
  if not @error then ExitLoop
  Sleep(100)
WEnd ;Sleep until you see this 2 image

Your bmp where not included in quotes, and return value is an array.   Please read carfully the headers of the functions.

Expand  

Hey, thanks for your help, I tried this code but it didn't worked for me

Posted (edited)
  On 4/13/2019 at 1:08 PM, Nine said:

that's a bad character coming from the copy/paste, just delete it...

Expand  

Not working, full code

While True
                  if not $pos1[0] then ContinueLoop
                     if $pos2[0] then ExitLoop
                        Sleep(100)
               WEnd
               If($pos1[0] And $pos2[0] = 1) Then
                  Sleep(2000)
                  MouseClick("left", 436 , 745 )
                  Sleep(5000)

Endif

 

THe code works with 0 errors, but the image its not found I guess

Edited by Zag8888
  • Developers
Posted
  On 4/13/2019 at 1:18 PM, Zag8888 said:

Not working, full code

While True
                  if not $pos1[0] then ContinueLoop
                     if $pos2[0] then ExitLoop
                        Sleep(100)
               WEnd
               If($pos1[0] And $pos2[0] = 1) Then
                  Sleep(2000)
                  MouseClick("left", 436 , 745 )
                  Sleep(5000)

Endif

 

THe code works with 0 errors, but the image its not found I guess

Expand  

Where in that code are you check for the image match?
What about you stop feeding us bits and pieces and post the full test code?

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.
  :)

Posted (edited)
  On 4/13/2019 at 1:23 PM, Jos said:

Where in that code are you check for the image match? Yes
What about you stop feeding us bits and pieces and post the full test code? Other code is useless and also is working perfectly...

Jos

Expand  

Edit, thanks for all your help guys, I have finally fix it, I added 5 tolerance instead of 0 and now it works great

Edited by Zag8888

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
×
×
  • Create New...