Sign in to follow this  
Followers 0
Meisi

A Question for PixelSearch

5 posts in this topic

Hi there!

I'm new to this forum, but I've allready written some AutoIt-Code before. Now I've written a new Script that would work perfectly if there wasn't that "small" problem:

I start a programm in window-mode. I found some code before to write customised functions. Thus Send and MouseClick works perfectly in that window. Even if it's minimized.

My Problem is that I want my Script to search for a specific color in that window. After a specified Sleep-time the Script should check for that color with PixelSearch, but everytime i check the Coordinates in the window and write that down in the Script, the script uses the wohle display to search for that specified color in that area.

Is there any way to check that specified area with PixelSearch - or with another command - in that window only? The window is active, but something won't work. I don't know how I could check that window only...

Can anybody help me please? I would be very pleased!

I tried to get rid of that problem with:

$checkcolor1 = PixelSearch( 634, 552, 641, 560, 0x000058, 0, 1, WinGetHandle("Programme"))
    If (@error=0) Then
    ....
    ....

but smthg won't work. Any hints!? Please!

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Ok are you saying the rectangle you give to PixelSearch is going off absolute screen coords, and you want it to be based on coords inside the window?

If so just use WinGetPos(). It returns x,y,width,height of a window in an array. Use that info to change your rectangle of pixels in PixelSearch(). This will cause it to search that window only.

Edited by ShawnW

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

Have a read up on PixelCoordMode Option.

Yeah i must be blind my 1st response before i edited it was MouseCoordMode then I read again and saw he wanted to change the pixel function not how he got his mouse coords. I looked through the AutoItSetOption page and totally skipped right over PixelCoordMode.

Edited by ShawnW

Share this post


Link to post
Share on other sites

Thanks a lot for your fast replies!! I will try it out right now :(

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  
Followers 0