Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Image search


  • Please log in to reply
8 replies to this topic
Kim Jong Un
  • Members
  • 16 posts
  • Last active: Jul 05 2013 03:27 AM
  • Joined: 08 May 2013
CoordMode, Pixel
ImageSearch, FoundX, FoundY, 172,492, 259, 552, C:\Users\BM\Desktop\New folder 2
if ErrorLevel = 0
MsgBox kim is here
else if ErrorLevel = 1
MsgBox no kim

 hi guys .

 

the code above is my code for image search. i have an image in my desktop and i want my pc to detect it. 

 

its not working

 

my goal is to search for a particular area (not the whole screen)

 

and plus if the image is detected, the mouse will click that image where ever it is( it is not included in my code)

 

 

 

 

 

 i know it is discusted here many times.. but Im too confused why they use this?

ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight, C:\Users\BM\Desktop\New folder 2

 

 

 

please make it simple and put explanation.. Thanks guys happy.png



HotKeyIt
  • Moderators
  • 7078 posts
  • Last active: Yesterday, 10:50 PM
  • Joined: 18 Jun 2008
CoordMode, Pixel, Screen ; search whole screen area, also uses screen coordinates
ImageSearch, FoundX, FoundY, 172,492, 259, 552, C:\Users\BM\Desktop\New folder 2\FileName.jpg ; here you were missing the file name for your picture
if ErrorLevel = 0
   MsgBox kim is here
else if ErrorLevel = 1
   MsgBox no kim


Kim Jong Un
  • Members
  • 16 posts
  • Last active: Jul 05 2013 03:27 AM
  • Joined: 08 May 2013

i got it working now.. thnks  Hot key it :) but how can i make my mouse click on that image where ever the image is?

 

 

 

This is code is used to search the whole screen regardless of its resolution right?

ImageSearch, FoundX, FoundY, 0, 0, A_ScreenWidth, A_ScreenHeight,c:/my cuddly_photo



HotKeyIt
  • Moderators
  • 7078 posts
  • Last active: Yesterday, 10:50 PM
  • Joined: 18 Jun 2008

Yes if you have one screen/monitor and don't forget to use right path to picture, e.g. c:/my cuddly_photo.jpg.



Kim Jong Un
  • Members
  • 16 posts
  • Last active: Jul 05 2013 03:27 AM
  • Joined: 08 May 2013

ah yes, i always forget that exact path , filename and the file extension lol

 

thnks for that  !! and more power to this community



Kim Jong Un
  • Members
  • 16 posts
  • Last active: Jul 05 2013 03:27 AM
  • Joined: 08 May 2013

Hello there, i made the code working properly, but this time i want to make the mouse clcik on that certain image.. the problem is the mouse keep on clicking on its current posistion..

 

here is my code

CoordMode, Pixel, Screen

ImageSearch, FoundX, FoundY, 0,446, 303, 703, loginbtn_out.jpg
if ErrorLevel = 0
    Click, FoundX, FoundY, Left
else if ErrorLevel = 1
    MsgBox nothing to click

Any help is very appreciated



HotKeyIt
  • Moderators
  • 7078 posts
  • Last active: Yesterday, 10:50 PM
  • Joined: 18 Jun 2008
ImageSearch, FoundX, FoundY, 0,446, 303, 703, loginbtn_out.jpg
if !ErrorLevel
    MouseClick,Left, % FoundX + 10,% FoundY + 10 ; add 10 pixels to click inside image
else
    MsgBox nothing to click

Try that way



Kim Jong Un
  • Members
  • 16 posts
  • Last active: Jul 05 2013 03:27 AM
  • Joined: 08 May 2013

Thnks :) got the code working now, i just add a control and a few minor adjustment.

CoordMode, pixel, screen
n::

ImageSearch, FoundX, FoundY, 0,402, 347, 703, loginbtn_out.jpg
if !ErrorLevel
    MouseClick, Left, % FoundX+50,% FoundY+20, 1, 1
else
    MsgBox nothing to click

I found out that the mouse clicking location behave according to a currently active window, so i have to minimize them all leaving my needed window active. Is there a way i can make it click to the same point regardless of any window open?



guest3456
  • Members
  • 1690 posts
  • Last active: Sep 11 2014 02:16 PM
  • Joined: 10 Mar 2011
http://www.autohotke...s/CoordMode.htm