Rydextillxixdiex Posted January 5, 2009 Posted January 5, 2009 (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 January 5, 2009 by Rydextillxixdiex ...will never learn all there is to know about autoit, no worries...i came to the forums :)
au3scr Posted January 5, 2009 Posted January 5, 2009 (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 January 5, 2009 by au3scr
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
au3scr Posted January 5, 2009 Posted January 5, 2009 (edited) Quote $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 January 5, 2009 by au3scr
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
au3scr Posted January 5, 2009 Posted January 5, 2009 What u mean?This will help you with percentagesRule: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 502-nd number is 100to 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)ndIf your your mouse Y position is 800 pixels and desktop width is 1280 pixels thenyou must divide 800 with 1280 (its 0,625) and multiply with 100 (it's 62.5)Rule 2To find % from number you must divide % by 100 and then multiply it with numberExamples:1) 80% from 10080 / 100 = 0.80.8 * 100 = 802) 35% from 102435 / 100 = 0.350.35 * 1024 = 358.4
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
FireFox Posted January 5, 2009 Posted January 5, 2009 (edited) 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 perhaps this is what you want... Edit : Completly wrong... @DesktopWidth-200*(1/100) @DesktopHeight-300*(1/100) Cheers, FireFox Edited January 5, 2009 by FireFox
au3scr Posted January 5, 2009 Posted January 5, 2009 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.
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
FireFox Posted January 5, 2009 Posted January 5, 2009 (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 January 5, 2009 by FireFox
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
FireFox Posted January 5, 2009 Posted January 5, 2009 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.
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 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 :)
Rydextillxixdiex Posted January 5, 2009 Author Posted January 5, 2009 $_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 :)
FireFox Posted January 5, 2009 Posted January 5, 2009 $FL = (150/@DesktopWidth) $_L = ($FL*@DesktopWidth) Cheers, FireFox.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now