Randomname Posted May 7, 2008 Share Posted May 7, 2008 Hi, I'm working on a script atm, and there's one thing that I need to do - but I can't think a way to do it, but I don't think it can't be done. So what I want to do is the following. Let's say we have one box of a specific color, say brown (doesn't really matter) the size and the position of the box is random, it can differ a couple of pixels. So, inside the brown box, there are white boxes (random position and size, though always inside the brown box, the number of white boxes are also random). I need a way to find out how many white boxes that are inside the brown box. Of course the boxes are in the active window. Of course I could just start checking each pixel of the screen... but that wouldn't be very effective would it? I don't need any code just some ideas on how to make this work. Thanks a lot in advance! Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 are the boxes gui elements, are they in apicture or what ? Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
Randomname Posted May 7, 2008 Author Share Posted May 7, 2008 (edited) are the boxes gui elements, are they in apicture or what ?They're in a picture .EDIT: Or at least they're not GUI elements. Edited May 7, 2008 by Randomname Link to comment Share on other sites More sharing options...
Randomname Posted May 7, 2008 Author Share Posted May 7, 2008 Can PixelSearch find the brown box even if there're white boxes inside of it? Link to comment Share on other sites More sharing options...
Randomname Posted May 7, 2008 Author Share Posted May 7, 2008 I've gotten a bit further, I can now get the coordinates of the brown box, the only thing I need to know now, is how many white boxes that can be found in a specified area. Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 are the boxes always detached or do they overlap ? Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
Randomname Posted May 7, 2008 Author Share Posted May 7, 2008 (edited) are the boxes always detached or do they overlap ?They're always detached. Edited May 7, 2008 by Randomname Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 (edited) mayby i've got it baut it's real crazy !you should write a cicle which pixel searches 2 pixels at a time so youll' start with 0,1 and then 2,3 and so onif both are white then they are part of the box (the white one)you add them in an array... the cicle runs til the image is finishedat the end the number of the second index of the array gives you the number of boxesEDIT: NO 2D ARRAY!! Edited May 7, 2008 by torels Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
torels Posted May 7, 2008 Share Posted May 7, 2008 #include <array.au3> $pw = "picturewidth" $y = 0 dim $h[1] for $i = 0 to $pw Step +2 if $i = $pw then $y += 1 $p1 = PixelGetColor($i,$y) $p2 = PixelGetColor($i + 1,$y) if $p1 = Dec("FFFFFF") and $p2 = Dec("FFFFFF") Then $h[0] = "t" if $p1 = Dec("FFFFFF") and $p2 <> Dec("FFFFFF") Then _ArrayAdd($h,"") if $p1 <> Dec("FFFFFF") and $p2 = Dec("FFFFFF") then $h[ubound($h) - 1] = "t" if $i >= $pw then exitloop Next return (UBound($h) - 1) / $pw should work! Some Projects:[list][*]ZIP UDF using no external files[*]iPod Music Transfer [*]iTunes UDF - fully integrate iTunes with au3[*]iTunes info (taskbar player hover)[*]Instant Run - run scripts without saving them before :)[*]Get Tube - YouTube Downloader[*]Lyric Finder 2 - Find Lyrics to any of your song[*]DeskBox - A Desktop Extension Tool[/list]indifference will ruin the world, but in the end... WHO CARES :P---------------http://torels.altervista.org Link to comment Share on other sites More sharing options...
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