blabla Posted June 18, 2004 Posted June 18, 2004 I've been fooling around a lot with the Pixel functions...I read the help file about PixelSearch and was wondering how would I initiate a function when a certain color DEC or HEX shows up with this command ??? I would like it to search pretty much all coordinates, so I'm thinking I would not enter coordinates for as default searches all coordinates??? am i right or if wrong please correct me... or show examples thanks again guys...
pekster Posted June 18, 2004 Posted June 18, 2004 (edited) You can tell the PixelSearch function to search the entire desktop, but it could take a while to do, longer if you have a higher resolution. You might want to look at the Step paramater. This will cause it to test every <Step> pixels, instead of checking every one of them. Just as an example, if you use the resolution 1280x1024, there are about 1.3 million pixels on your screen that it would have to test. That could take a little bit without setting a fairly high step (maybe 5 or 8 or something in that range for a step for starters.)I've provided some code below that will wait for a pixel to exist on the screen, with a step of 5. I also included a tooltip in the upper right corner. Although you may not want the tooltip in your program, you will want to use it to see how long each pass of testing the entire screen takes. It's just a counter to count the number of times it checks the desktop, and therefore gives you an indicitation of how fast it goes at the particular step value you selected.$count = 0 $step = 5;change this for an easy way to adjust the step Do $count = $count + 1 ToolTip("Running screen check number " & $count, 0, 0);update tooltip PixelSearch(0, 0, @DesktopWidth - 1, @DesktopHeight - 1, 0xABCDEF, 0, $step) Until NOT @error ;now the pixel was found, so do some stuffJust change the $step var at the top to increase or decrease the number of pixels it checks. Remember, the higher the number, the more it skips over, but the faster the code will run. You'll probably also need to adjust the pixel color to search for.Typo and grammar corrected2nd Edit to add in the addition to the $count variable so it would change Edited June 18, 2004 by pekster [font="Optima"]"Standing in the rain, twisted and insane, we are holding onto nothing.Feeling every breath, holding no regrets, we're still looking out for something."[/font]Note: my projects are off-line until I can spend more time to make them compatable with syntax changes.
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