Jump to content
Sign in to follow this  
ravenfrozt

I need help for a stupid question :)

Recommended Posts

ravenfrozt

hello all, I just wonder how do you get the coords for the rectangle ty

ex: ..."left","top","right","bottom"

Share this post


Link to post
Share on other sites
NBJ

If you are asking what numbers you put into the left, top, right, bottom

PixelSearch ( left, top, right, bottom, color )

You specify them: they can be anywhere on your screen, so the values really depend on the resolution of your Monitor(s)

if you specify PixelSearch ( 0,0,10,10,0xFF0000) then it will search the top left corner of the monitor in a 10x10 pixel rectangle.

Does this answer what you are asking?

Share this post


Link to post
Share on other sites
qazwsx

Autoit info tool in Scite.

Share this post


Link to post
Share on other sites
NBJ

Autoit info tool in Scite.

That would be what he is asking ^_^ It was hard to tell ;) Cheers

Share this post


Link to post
Share on other sites
herewasplato

... how do you get the coords for the rectangle ty ...

A belated welcome to the forum.

There are a few things that you might want to take into account when gathering the coordinates for the rectangle in question... like:

Are these coordinated with respect to (wrt) the whole screen?

Are these coordinated wrt the active window?

... client area of the window?

Confused yet? :-)

Let's just deal with the first two questions that I asked above. Run this little script and see if the TrayTip info makes any sense to you as you move the mouse around your screen/windows. Click on various windows to activate them.

HotKeySet("{ESC}", "Terminate")

While 1
    ;1 = absolute screen coordinates (default)
    Opt("MouseCoordMode", 1)
    $posA = MouseGetPos()
   
    ;0 = relative coords to the defined window
    Opt("MouseCoordMode", 0)
    $posW = MouseGetPos()
    TrayTip("Press Esc to exit.", "X: " & $posA[0] & ", " & _
            "Y: " & $posA[1] & " Color: " & _
            PixelGetColor($posA[0], $posA[1]) & @CR & _
            "X: " & $posW[0] & ", " & _
            "Y: " & $posW[1] & " Active window", 10)
    Sleep(10)
WEnd

Func Terminate()
    Exit
EndFunc   ;==>Terminate

If you are using this info for one of the Pixel... functions, then you will want to match the "AutoItSetOption" or "Opt" settings. "Opt" settings are usually put near the top of your script and not in a loop like I have above... unless you need to constantly change them :-)

MouseCoordMode

Sets the way coords are used in the mouse functions, either absolute coords or coords relative to the current active window:

0 = relative coords to the active window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the active window

PixelCoordMode

Sets the way coords are used in the pixel functions, either absolute coords or coords relative to the window defined by hwnd (default active window):

0 = relative coords to the defined window

1 = absolute screen coordinates (default)

2 = relative coords to the client area of the defined window

Also, some night when you cannot sleep - read thru this:

http://www.autoitscript.com/forum/index.php?showtopic=19722

Edit: If you gather the X and Y values using the "AutoIt Window Info" tool, then you may need to change the settings within that tool to match the "Opt" settings that you may be using in your script.

Posted Image

Edited by herewasplato

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

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  

×