Jump to content
billshu

_ImageSearch with $transparency

Recommended Posts

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

Share this post


Link to post
Share on other sites
AutoBert

Play with param tolerance, but there are better ways to automate a app than imagesearch? So, which app?

Share this post


Link to post
Share on other sites
billshu

Thanks for the comment.   If I can't get transparency to work, i will try more with tolerance, but tolerance is difficult if the background changes a lot.

Share this post


Link to post
Share on other sites
AutoBert

And don't forget mousecoursor is also on screen, so when it's no game just just name the app.

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

    • Yirrlaar
      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?
    • Yirrlaar
      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?
    • computergroove
      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.
×