Jump to content
Zag8888

_ImageSearch Unknown function name

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

Share this post


Link to post
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?

Share this post


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

Share this post


Link to post
Share on other sites

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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
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!

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
21 minutes ago, Nine said:

ya reread my post I changed it so it should work now...

Missing separator character after keyword.:
WEnd?
WEnd^ ERROR

Share this post


Link to post
Share on other sites
Just now, Nine said:

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

thanks now work, I'm trying it rn

Share this post


Link to post
Share on other sites
Posted (edited)
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

Share this post


Link to post
Share on other sites
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 Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Posted (edited)
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

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

  • Similar Content

    • By Yirrlaar
      Hello All,
      I'm using "ImageSearch2015.au3" and i'm trying to figure out WHY, for the life of me, I can't find an image is hidden.
      So what I came up with, is as follows:
      _ImageSearchAreaHidden("C:\icon.png", 1, 0, 0, 800, 600, $x1, $y1, 80, 0) Func _ImageSearchAreaHidden($findImage, $resultPosition, $x1, $y1, $right, $bottom, ByRef $x, ByRef $y, $tolerance, $transparency = 0) Local $h, $result local $TestScreen = "C:\TestScreen.png" ;previsous screenshot of the image looking for, fully visible If Not FileExists($findImage) Then Return "Image File not found" If $transparency <> 0 Then $findImage = "*" & $transparency & " " & $findImage If $tolerance < 0 Or $tolerance > 255 Then $tolerance = 0 If $h_ImageSearchDLL = -1 Then _ImageSearchStartup() If $tolerance > 0 Then $findImage = "*" & $tolerance & " " & $findImage $result = DllCall($h_ImageSearchDLL, "str", "ImageSearchEx", "str", $TestScreen, "int", $x1, "int", $y1, "int", $right, "int", $bottom, "str", $findImage) If @error Then Return "DllCall Error=" & @error If $result = "0" Then Return False $array = StringSplit($result[0], "|") If (UBound($array) >= 4) Then $x = Int(Number($array[2])) ; Get the x,y location of the match $y = Int(Number($array[3])) If $resultPosition = 1 Then $x = $x + Int(Number($array[4]) / 2) ; Account for the size of the image to compute the centre of search $y = $y + Int(Number($array[5]) / 2) EndIf Return True EndIf EndFunc ;==>_ImageSearchAreaHidden Now when the folder with the icon is completely visible, it finds the icon without any issues, however if I cover up the icon, it no longer finds the image in the folder.
      Any ideas?
    • By Yirrlaar
      Here is the thing, I have a picture that has "duplicate" items of what I am searching for.
      I used the windows "paint" to crop a small section of the OVERALL screenshot to use as my search item.
      Now, I have NO issues running the script, as it finds what I am looking for RIGHT AWAY!!! YEAH!!!!
      But if I were to edit the original picture and "remove" the 1st image it finds (the one I "cropped" out) and run the script again, it never finds any of those duplicate images and they are a direct copy & paste of the original image i am trying to find.
      $result = _ImageSearch($picture,0,$x1,$y1,100,0) Is there any other Image Search au3 out there that can made find multiple versions of an image?
    • By computergroove
      I am trying to integrate imagesearch into a script I am making. When I try to compile the script I get the following inside imagesearch.au3 under all 4 of the imagesearch.au3 defined functions:
      "Error: Missing separator character before keyword"
      I tried the beta version of Autoit and it is doing the same thing. I am using the x32 version of the imagesearch.au3 found here - https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&uact=8&ved=0ahUKEwiUmsrEsLzPAhWs7YMKHS9MClQQFggfMAA&url=https%3A%2F%2Fwww.autoitscript.com%2Fforum%2Ftopic%2F148005-imagesearch-usage-explanation%2F&usg=AFQjCNFwpFnZMxVK9H4cDASRnjiB-65gOw&bvm=bv.134495766,d.amc
      I have put the imagesearchDLL.dll in both the includes directory and the system32 directory. I am using x64 Windows 8.1 Pro. I cant see anything wrong. Please help.
    • By billshu
      Does anyone have experience with transparency on _ImageSearch?  The code attached finds the image "base.bmp" but at position 0,0 not near the center of the screen as it appears. My goal is to find the Big Blue "G" regardless of the background.  I have not yet found the base image, so I have not tested changing the background. Do you have to use image formats that support transparency?  If so, how would you capture the image from within autoit code and set the transparency color?
      Test1.au3
      ImageSearch.au3
      base.bmp
×
×
  • Create New...