Sign in to follow this  
Followers 0
Rydextillxixdiex

Coordinates - Identifying Portion of Screen

18 posts in this topic

#1 ·  Posted (edited)

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 :)

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$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

Share this post


Link to post
Share on other sites

Ah thanks, your the best. Works great and makes my scripting much easier :).


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

Share this post


Link to post
Share on other sites

np


Share this post


Link to post
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 :)

Share this post


Link to post
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


Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

: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

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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.


Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

#13 ·  Posted (edited)

Ive understood now :)

60% = 60/100, right ?

((60/100)*@DesktopWidth)*(1/100)

Not sure at all but its the concept to calculate it...

Cheers, FireFox.

Edited by FireFox

 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

So, will this work to assign the variable then?

$L = ((60/100)*@DesktopWidth)*(1/100)

or

$L = (0.60*@DesktopWidth)*(0.01)

;====???????=====


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

Share this post


Link to post
Share on other sites

no... its the percent of the point coords and no pixel coords, this wont work :)

Why do you want to convert it to percent ?

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
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 :)

Share this post


Link to post
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 :)

Share this post


Link to post
Share on other sites

$FL = (150/@DesktopWidth)
$_L = ($FL*@DesktopWidth)

Cheers, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

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