Jump to content

_ImageSearch Unknown function name


Recommended Posts

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
Link to comment
Share on other sites

  • Developers

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

Jos

Edited 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

1 minute ago, Jos said:

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

JOs

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

Link to comment
Share on other sites

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
Link to comment
Share on other sites

  • Developers

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

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

12 minutes ago, 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

I have fixed this, and now it work!

Link to comment
Share on other sites

20 minutes ago, 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.

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

Link to comment
Share on other sites

12 minutes ago, Nine said:

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

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
Link to comment
Share on other sites

  • Developers
3 minutes ago, 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

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

Link to comment
Share on other sites

2 hours ago, 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

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
Link to comment
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
 Share

×
×
  • Create New...