Jump to content

Pixel Search In A Window


Bert
 Share

Recommended Posts

I think this has been asked before, but in searching for it, I got lost in to many results.

What I'm looking to do is this:

1. Open Internet explorer

2. A pixel search is ran in the window to find where the upper left corner of the viewing window is located. This would ignore the address bar, links bar, standard buttons bar, and any other bar that has been added (Google toolbar, yahoo toolbar, and so forth)

3. Once the pixle I need is located, I will run the toolbar script that GaFrost made. The toolbar will have it's upper left corner parked on that pixel.

I know the color of the pixel I'm looking for, so I don't need to worry about it changing color. I just need to be able to locate the pixel no matter how the window is moved around the screen, or resized.

I thought of using PixelSearch, but it searches the entire screen. I'm not sure how to go about this one.

Thoughts?

Link to comment
Share on other sites

The window I need to work with doesn't have a control I can track :) (don't get me started on that one) All I can see in the window is the title, the status bar on the bottom, and information in the address bar.

I came up with this, and it works, but it is getting the white in the toolbar. I thought it was all gray, until I looked real close.

Opt("WinTitleMatchMode", 2)
$color = "0x705F57" 
WinWaitActive("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")
$size = WinGetPos("Unicenter ServicePlus Service Desk", "http://usdp/CAisd/pdmweb.exe")
$xxx = $size[0]
$yyy = $size[1]
$m1 = "30"   ;how much to move left
$m2 = "28"   ;how much to come down from the top
$m3 = "100";how far to go the right
$m4 = "150";how far to go down
$coord = PixelSearch($xxx + $m1, $yyy + $m2, $xxx + $m3 , $yyy + $m4, $color)
MsgBox(0, "X and Y are:", $coord[0] & "," & $coord[1])

Take a look at the jpg I put in. I circled in red where I'm trying to find. I need the 0xFFFFFF in the corner there. There is white in the toolbar, so I need to avoid it. Also, I can't use the toolbar as a reference due to it could be changed by a user.

Thoughts?

Edited by vollyman
Link to comment
Share on other sites

The window I need to work with doesn't have a control I can track...

...but, does it have a ClassNameNN and is it:

Internet Explorer_Server1

Opt("MouseCoordMode", 2)
Opt("WinTitleMatchMode", 2)

WinActivate("Microsoft Internet Explorer")

$ClientPos = ControlGetPos("Microsoft Internet Explorer", "", "Internet Explorer_Server1")

MouseMove($ClientPos[0], $ClientPos[1])
What happens when you run the code big_daddy provided... or the code above.

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

me ---> :)

For some reason, I didn't get the jist of the code from big_daddy, and that is why I didn't think it would work. His code does the trick nicely. I must have been lost in lala land or something. Thanks big_daddy.

@herewasplato: Thanks dude for pointing it out to me. I must need coffee or something.

Link to comment
Share on other sites

...@herewasplato: Thanks dude for pointing it out to me. I must need coffee or something.

It was the least I could do after giving you the bad advice to look into WinGetPos and WinGetClientSize --- I really thought that you get there with those functions --- 'til I had the time to test it. I hope that you did not waste any time on that.

I already knew the answer to my question before I posted it:

...but, does it have a ClassNameNN and is it:

Internet Explorer_Server1

from the Active Window info in your other recent post

http://www.autoitscript.com/forum/index.ph...showtopic=21099

I wonder if it is possible to have an IE window without that ClassNameNN?

...later...

[size="1"][font="Arial"].[u].[/u][/font][/size]

Link to comment
Share on other sites

  • Moderators

I hope that you did not waste any time on that.

Quite doubtful anyone feels what you have to say is a waiste of time :).

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...