Xibalba Posted July 13, 2010 Posted July 13, 2010 (edited) Greetings AutoIT forum,1)I have a simple image file opened at the top left corner of my screen.The actual image is 350x350px and with the script moved to x,y 0 0.The image is all white with one single black dot.I took a Full Print-Screen and measured the distance to the dot from the screen edges in Photoshop - x,y 245 259.When running the script using PixelSearch( 42, 82, 350, 350, 0x000000 ), it says the pixel is found at 246 262 ?!(The x,y 42 82 is just to "jump in" and skip the Image Viewer toolbar etc)I can buy the x: 246 (depending on if x is where the pixel is found, or if the next pixel counts), but the y 262???2)Regarding function reference: How exactly does the "search direction" work and how do I change it (there is no argument for it) ?3)According to function reference: "color | Colour value of pixel to find (in decimal or hex)."How come the example below uses "0xFF0000" and not just "FF0000" ? Perhaps best to use decimal (255 0 0) ?I have read and elaborated with the docs for the PixelSearch function as well as searched for simple example scripts, without too great success.Thanks in advance. Edited July 13, 2010 by Xibalba
Sobiech Posted July 14, 2010 Posted July 14, 2010 1) Please add screenshot, this help a little to create a code 2) i saw that is checking each pixel from left up corner to right up corner (step by +1 pixel) No, i tried to change direction a little bit, but fail ;\ (I am not perfect ) 3) idk, but where is the problem? This world is crazy
AdmiralAlkex Posted July 14, 2010 Posted July 14, 2010 1. What is the question here? Why y is 262? Only you know that, we don't know how your screen looked when you got that.2. The helpfile tells you how to do it. Quote The search direction varies as follows: Left-to-Right - left < right Right-to-Left - right < left Top-to-Bottom - top < bottom Bottom-to-Top - bottom < topSo if you want to search from right to left just put the left coordinate in the right parameter and vice versa.3. Because you write hex as 0xFF0000, writing just FF0000 means nothing. Quote Perhaps best to use decimal?That doesn't matter. Decimal and Hex is the same thing in AutoIt, and you can freely interchange them with each other. .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Sobiech Posted July 14, 2010 Posted July 14, 2010 Hmm i saw program with pixelsearch wrote with decimal format of pixels, and one line "This wont work on 32 bit desktop settings" So dec wont work with 32bit? I ppreffer to using Hex This world is crazy
AdmiralAlkex Posted July 14, 2010 Posted July 14, 2010 Do you really have to ask that? PixelSearch(0, 0, @DesktopWidth, @DesktopHeight, 16777215) Exit @error(weirdest PixelSearch example ever?) .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface
Xibalba Posted July 14, 2010 Author Posted July 14, 2010 (edited) I figured out my questions by further testing. I added one pixel to my MsgBox output ($coord[0]+1), ($coord[1]+1) to get true visual distance (easy measurable in ps).Thanks for an explanation of search direction, although I find the docs rather confusing, what about replacing:Bottom-to-Top - bottom < topwithBottom-to-Top - bottom < top (If the bottom parameter < top parameter, Bottom-to-Top search direction is used.)...Or just add a another example below, searching Bottom-to-Top and Right-to-Left?Anyway, thanks for all the replies. Edited July 14, 2010 by Xibalba
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