Jump to content

Coordinates - Identifying Portion of Screen


Recommended Posts

I'm looking for a way to tell my script to search for the color in a specified region of the screen: I.e. a quadrant in my case. Since screen sizes vary, it is difficult to make a multi-monitor-functioning script to be used in many locations/on many machines.

It would be great if a plug in <Proper Term?> was developed that would use percentages as apposed to pixel values to identify the locations for coordinates. Since items scale on a larger/smaller screen, it would make perfect since for it to work off of percentages. If an item to search for is 25% off the L-Edge of the screen - 1/4 over - on a 15" screen, it will also be 25% off the L-Edge of a much smaller...or even a larger monitor if the item on screen scales (Most Items Do).

Just thought this would be a great addition to auto it and would make developing cross-monitor/system programs more viable.

Note: Sorry if this feature already exist and it has blown over my head. :)

Edited by Rydextillxixdiex

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

What did you mean?

maybe this

MouseClick("left",@DesktopWidth * 0.25,@DesktopHeight * 0.25)

explain more please or maybe even post screenshot :) so I can understand you better

Edited by au3scr
Link to comment
Share on other sites

Ah, that is what i meant haha. Exactly what i meant. Is it possible to get exact % though say of your current mouse postition, i know autoit window info gives you pixel information of your mouse but not %s.

Thanks haha.

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

$pos = MouseGetPos()

MsgBox(0, "Mouse x,y:", "x"&$pos[0] & " y"&$pos[1] &" X % is:" & Round($pos[0] / @DesktopWidth *100,0) & $pos[1]&" Y % is:" & Round($pos[1] / @DesktopHeight *100,0) )

X % is a little buggy , you need to take 1-st 2 numbers

Here is replacement (FIX)

$pos = MouseGetPos()
MsgBox(0, "Mouse x,y:", "X cordinate: "&$pos[0] & " Y Cordinate: "&$pos[1] &" X % of screen width is: " & StringLeft(Round($pos[0] / @DesktopWidth  *100,0),2) &"% Y % of screen height is: " & Round($pos[1] / @DesktopHeight *100,0) & "%"  )
Edited by au3scr
Link to comment
Share on other sites

One more question, how do i integrate this into my script now the @Desktop id's?

I'm going to predefine the margins at the beginning as follows:

$1_L = @DesktopWidth                ;== ??????? ==
$1_T = @DesktopHeight               ;== ??????? ==
$1_R = @DesktopWidth               ;== ??????? ==
$1_B = @DesktopHeight              ;== ??????? ==

I obvioulsy want L to be the left margin, T- top, R- Right, B- Bottom, how would i go about doing this using the percentages i obtain?

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

What u mean?

This will help you with percentages

Rule:

To find how many % is 1st number from second you must divide 1-st number by second one and then multiply by 100 number.

usage examples:

1)

1-st number is 50

2-nd number is 100

to find how many % is 50 from 100 you must divide by 50 with 100 (its 0.5) and multiply it by 100 and answer is 50%

2)nd

If your your mouse Y position is 800 pixels and desktop width is 1280 pixels then

you must divide 800 with 1280 (its 0,625) and multiply with 100 (it's 62.5)

Rule 2

To find % from number you must divide % by 100 and then multiply it with number

Examples:

1) 80% from 100

80 / 100 = 0.8

0.8 * 100 = 80

2) 35% from 1024

35 / 100 = 0.35

0.35 * 1024 = 358.4

Link to comment
Share on other sites

Thats not quiet what i mean, i can do the math.

Can you set your margins to a percentage though?

for example:

$1_L = @DesktopWidth                ;== ??????? ==
$1_T = @DesktopHeight               ;== ??????? ==
$1_R = @DesktopWidth               ;== ??????? ==
$1_B = @DesktopHeight              ;== ??????? ==oÝ÷ ÚØZ·¥«, íêZ­©µêì²ç!jÍ7ëR

What im trying to accomplish is assigning the "$1_L" varriables the percentage off the borders of the screen to be USED as the paramaters for coordinate apps such as pixel search and mouse click.

Thanks.

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

:D Missunderstand :)

If you want to have left or top of screen this would be 0% and for width and height 100%...

You wanna calculate point of coords 200,300 for example :

1-(200/100)*@DesktopWidth
1-(300/100)*@DesktopHeight
;or...
1-(@DesktopWidth-200/100)
1-(@DesktopHeight-300/100)

Im so bad in math :D perhaps this is what you want...

Edit : Completly wrong... :o

@DesktopWidth-200*(1/100)

@DesktopHeight-300*(1/100)

Cheers, FireFox

Edited by FireFox
Link to comment
Share on other sites

if you are trying to tell your script area then maybe this

PixelSearch(0, 0, $1_R, $1_B, 0x600000, 10)

;From upper corner to desktop end, I didnt found other words here :) I Can't understand what u want, and I have to go sleep now sorry.

I have never used pixel search function.

I will be back tomorrow.

Link to comment
Share on other sites

Haha no we got off topic on a math tangent.

All i am trying to do is assign:

$L =
$T =
$R =
$B =

Thanks for you help, hopefully this clears up confusion haha. My simple task turned into a nightmare for you guys because i didn't explain it well, my fault.

Sorry about the double spacing....bad habbit?

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

Because if i don't convert it to % then i runs off of pixels which are solely operable on one size monitor. If the window scales that the user is searching within then by using percents, it can work on any monitor.

...will never learn all there is to know about autoit, no worries...i came to the forums :)

Link to comment
Share on other sites

$_L = (0.15*@DesktopWidth)
$_T = (0.70*@DesktopHeight)
$_R = (0.30*@DesktopWidth)
$_B = (0.80*@DesktopHeight)

This works just fine to declare my area: the 4 $ are then placed in the mouseclick( or pixelsearch( and it works great. Thanks.

...will never learn all there is to know about autoit, no worries...i came to the forums :)

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