dcsimg
Results 1 to 7 of 7

Thread: Find location on the screen

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    41

    Exclamation Find location on the screen

    Hello,

    Is there any way to find source image and compare it with the screen shot of the current screen ? If the image matches with the current screen shot image then it should find X and Y of the matched image. Is it possible ?

  2. #2
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,251

    Re: Find location on the screen


  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    41

    Re: Find location on the screen

    Thanks! It's working but it doesn't provide the accurate X and Y location where the image found. For example, I have taken the screenshot of my desktop and stored it in bitmap. And in other file I have saved the some part of the desktop and tried to compare, location found but it was not accurate. Why ? I have checked several times but same result. What could be the issue ? Actually what I want to do is that find location with Image and set cursor on that area and perform some action.

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    102,567

    Re: Find location on the screen

    Quote Originally Posted by abhishek009 View Post
    Thanks! It's working but it doesn't provide the accurate X and Y location where the image found. For example, I have taken the screenshot of my desktop and stored it in bitmap. And in other file I have saved the some part of the desktop and tried to compare, location found but it was not accurate. Why ? I have checked several times but same result. What could be the issue ? Actually what I want to do is that find location with Image and set cursor on that area and perform some action.
    I think that that's probably too vague a description for us to say what the issue might be. Please be specific. What EXACTLY did you do and what EXACTLY happened?

  5. #5

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    41

    Re: Find location on the screen

    I'm trying to automate external application which is loaded on web browser. I get screenshot of the chrome window. Then I want to find the location of search window, so I took the screenshot of that area of search. and then matching that area with the entire screenshot and then using SerCursor I set the cursor with found location and then perform some operations.

  6. #6
    VB For Fun Edgemeal's Avatar
    Join Date
    Sep 2006
    Location
    WindowFromPoint
    Posts
    4,251

    Re: Find location on the screen

    Quote Originally Posted by abhishek009 View Post
    Thanks! It's working but it doesn't provide the accurate X and Y location where the image found. For example, I have taken the screenshot of my desktop and stored it in bitmap. And in other file I have saved the some part of the desktop and tried to compare, location found but it was not accurate. Why ? I have checked several times but same result. What could be the issue ? Actually what I want to do is that find location with Image and set cursor on that area and perform some action.
    Can only guess you have an offset somewhere, either in the code or in the images, e.g., the browser scrollbars were scrolled when you captured the images and is not scrolled at compare time. Other then that the code in the link seems to work fine here except when the find image is at the very-bottom-right of the full image, then its not found, to fix that I removed the -1 from the x and y for-loops in Function FindMatch.

    BTW, instead of using SetCursor API you can use Cursor.Position = New Point(x,y).

  7. #7

    Thread Starter
    Member
    Join Date
    Jun 2014
    Posts
    41

    Re: Find location on the screen

    Thanks! Then how can I automate Web Browsers without inspecting HTML attributes ?

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width