Jump to content

Finding Dimentions of a box created by mouse over


Recommended Posts

My Problem: Ok, so im playing around with Tesseract and Autoit and Ive run into a small problem.

I want to search a box that only shows when you move your mouse over the object. The box is a random

size and shape AND it only appears when your mouse is over the object. If you move your mouse off the object

onto the box, then it disappears.

My Question: Is there a way for autoit to be able to recognize a new box appearing, and then

be able to check the coordinates of the corners or something to get the size of it?

The Main Gist: I roll my mouse over the image, a random box appears, text is in the box, read whats in the box

and only whats in the box.

What i can already do: I am able to make it successfully read the text inside the box and around the box, but i want it

to be more precise in what it is reading and set it ONLY to whats inside the box. When i set it to read the square in the box and

outside the box, i get results back that aren't helpful in the least bit.

If there is any more information i can give to help make this easier to answer, just let me know.

Its realllllly late here and im just trying to type this before i go to bed.

Thanks for the help in advance

~Shakala

EDIT:

Aditional Information: This box that appears is located inside another window, when you roll over it, and use *Autoit Window Information*,

it still says it's part of the main window. So as far as i know, using the winwaitactive and wingetpos wont help with this at all.

Edited by Shakala
Link to comment
Share on other sites

You want to be looking at

WinExists() to detect the window.

WinActivate() if its not already active.

WinGetPos() to get the co-ordinates of the window, which you can use for your calculations.

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

This box that appears is located inside another window, when you roll over it, and use *Autoit Window Information*, it still says it's part of the main window. So as far as i know, using the winwaitactive and wingetpos wont help with this at all.

Thanks

~Shakala

Link to comment
Share on other sites

What type of box is it? standard windows gui, flash, tooltip ....

That probably would of been good to mention...

It was for a flash game. Which is why i had problems.

I seem to of misplaced the link to the game so it doesn't matter really, but if it wont take much time

i would like to see how it would have been done. Thanks

~Shakala

Link to comment
Share on other sites

Hmmm, flash games eh, not everyone is a big fan of them.

I can give you a direction, as you know the functions you mentioned wont help you, so your only way forward is the pixel functions and image UDFs. If I remember there is Imagesearch and FindBmp knocking about the forum along with some others, you will have to find them.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

I already got the image search one, but since the box keeps changing, and the text inside is also changing, it wont work the way i want. and ill look for the find bmp one and take a look at it and see what i can do.

anyone else got an idea?

Link to comment
Share on other sites

  • 3 weeks later...

I already got the image search one, but since the box keeps changing, and the text inside is also changing, it wont work the way i want. and ill look for the find bmp one and take a look at it and see what i can do.

anyone else got an idea?

The source of findbmp can help you out in a direction especially the part to get the getdibits part.

Steps to do it

1. Determine the maximum size of the box you want to get

2. When you want to take a look if there is a box on the screen you capture the area to investigate (can be full screen but thats probably slow) based on the x and y coordinates of your mouse

3. With the getdibits (see findbmp source) you can get a long byte(string) where you can search for a certain pattern

4. You can work that out to do a dumphex and analyse how the box is recognizable

5. see also color replacing logic http://www.autoitscript.com/forum/index.php?showtopic=112341 to rule out certain areas (with several replaces you will remove all color till only the color of the box is left and then you determine the dimensions.

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...