Jump to content
Sign in to follow this  
masterland

ImageSearch tolerance do not work

Recommended Posts

masterland

Hello.

I had made a bot that clicks and doing stuff. It is working fine, but when i move it to another PC ImageSearch stop working. I captured same image of a button again and i observed that they are a little bit different. How to deal with this? I wonder if i will make black and white detection might work, or not ... i don't know. The point is i am not willing to re-do photos on each and every PC i move the scripts.
 

ClickOnImageWithToleranceFast("images/fb_about.bmp",16)

Func ClickOnImageWithToleranceFast($image_path,$tolerance)
   If SearchForImageOnScreenWithTolerance($image_path,$tolerance) Then
      If $x <> 0 And $y <> 0 Then
         MouseMove($x+5, $y+5,0)
         Sleep(500)

         MouseClick("left")
         Sleep(500)
      EndIf
   EndIf
EndFunc

 

Link : https://postimg.org/gallery/z6n168ps/585debf1/#

Also i have attached them.

Thank you

fb_about.bmp

fb_about2.bmp

Share this post


Link to post
Share on other sites
rootx

Perhaps because it changes the screen resolution and DPI Zoom, before launching the function, first try to capture the actual screen resolution.

Share this post


Link to post
Share on other sites
masterland
1 minute ago, rootx said:

Perhaps because it changes the screen resolution and DPI Zoom, before launching the function, first try to capture the actual screen resolution.

Don't quite understand, you say that might be a problem with the fact that i use different resolution? And i am at 100% zoom on browser, i never changed that.

Share this post


Link to post
Share on other sites
rootx

try to verify browser zoom, and monitor resolution and DPI zoom, because... 4example if you run a 3840x2160 resolution on a 15 inch laptop.... windows suggest you to change the DPI Zoom to 250%... etc.... Result?? your script doesnt work well.

Share this post


Link to post
Share on other sites
masterland
30 minutes ago, rootx said:

try to verify browser zoom, and monitor resolution and DPI zoom, because... 4example if you run a 3840x2160 resolution on a 15 inch laptop.... windows suggest you to change the DPI Zoom to 250%... etc.... Result?? your script doesnt work well.

So you say that every time i try do ImageSearch, the images must have high DPI so therefore capture that button when i am very zoomed (250%). This is what you say? We have to be aware that the img will not be 20x50 ... will be +150% bigger, i don't know for sure if it will work

2 minutes ago, Bert said:

Question -why do you have to use pixelsearch to click on a button? Why can't you just hook into the button control?

Whats the name of the app? odds are there is a script that is already made that will do the work for you and be MUCH more stable.

I use pixelsearch because i believe it is faster to capture and click. I use FF.au3 lib, wich is very good http://english.documentation.ff-au3.thorsten-willert.de/

I am trying to add friends on FB, but i need it from scratch made, i am using a DB behind. I also use xpath from FF.au3, but somethimes don't work, and i relay on ImageSearch.dll

Share this post


Link to post
Share on other sites
VandanaS
On 1/23/2017 at 9:01 PM, masterland said:

Hello.

I had made a bot that clicks and doing stuff. It is working fine, but when i move it to another PC ImageSearch stop working. I captured same image of a button again and i observed that they are a little bit different. How to deal with this? I wonder if i will make black and white detection might work, or not ... i don't know. The point is i am not willing to re-do photos on each and every PC i move the scripts.
 

ClickOnImageWithToleranceFast("images/fb_about.bmp",16)

Func ClickOnImageWithToleranceFast($image_path,$tolerance)
   If SearchForImageOnScreenWithTolerance($image_path,$tolerance) Then
      If $x <> 0 And $y <> 0 Then
         MouseMove($x+5, $y+5,0)
         Sleep(500)

         MouseClick("left")
         Sleep(500)
      EndIf
   EndIf
EndFunc

 

Link : https://postimg.org/gallery/z6n168ps/585debf1/#

Also i have attached them.

Thank you

fb_about.bmp

fb_about2.bmp

Hi,

I have seen ur images. the images which i captured are of almost similar size. But my script is not able to find such small images. please 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  

  • Similar Content

    • Pagi
      By Pagi
       
      <a href="index.php=4143b27b41db0a40c499202865c3e24d" class="menuitem " target="\_self"> "Menu Item 1" </a>
      Can you tell me if it´s possible to click this menu button? If yes, how? Cause I have no idea, I think i should use _IETagNameGetCollection
    • mar3011
      By mar3011
      hello, I want to set in the inputbox field random key from the keyboard to which the function will be assigned, for example F4 function start notepad ALT + A function start notepad for one function. Thank you for any help.  
    • JuanFelipe
      By JuanFelipe
      Cambiar a español Hello friends, I need help with a problem I have, I want to know if there is any way to update a GUI already running, that is I have a GUI of a certain size and with a button I would like to enlarge it:
      example: $ form1 = GUICreate ("", 200,100,0,0)   When you press the button, the gui increases its size, and actuates the new size.
    • BogdanNicolescu
      By BogdanNicolescu
      While 1 / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / WEnd OR:

       
      HotKeySet("{ESC}", "Terminate") While 1 MouseClick("Right",674,422) MouseClick("Left",673,447) Sleep(2000) / / / A whole bunch of codes found in help and here: https://www.autoitscript.com/autoit3/docs/ / / / MouseClick("Left",675,339) SLeep(3000) WEnd Func Terminate()     Exit 0 EndFunc  
      Sorry if i should't let this here to be found by newbies like me -.-'
    • santoshM
      By santoshM
      Dear friends i am facing a problem , i have created a window in autoit some time it is moving with the mouse curser even if iam not clicking the window 
×