iamtheky Posted April 29, 2013 Share Posted April 29, 2013 (edited) I would like to check the pixel in the center of each of the 14 lines, those lines will be in the same place everytime, if present. My thought for initial behavior would be If its less than 0x6f6f6f return 0, else return 1. I am just starting, but figured I would get more variety and better quality solutions by posting, rather than continued hunting. Edited April 30, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 29, 2013 Moderators Share Posted April 29, 2013 boththose, Sounds a reasonable approach to me - I once automated an old DOS app using something very similar. M23 Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind Open spoiler to see my UDFs: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
jdelaney Posted April 29, 2013 Share Posted April 29, 2013 (edited) PixelSearch allows tolerances which should grab all the potential shades of white, while easily skipping gray/black...don't need to go higher than 1 pixel for each spot....the _ColorGet* functions are helpful too...you would expect values closer to 240-255 (probably) for all three (rgb) Edited April 29, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
JohnOne Posted April 29, 2013 Share Posted April 29, 2013 Question: what pixel would be the center pixel of a 14 pixel line? AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
jdelaney Posted April 30, 2013 Share Posted April 30, 2013 (edited) don't need to go higher than 1 pixel for each spotspot being a point on each line....PixelSearch requires a range Edited April 30, 2013 by jdelaney IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
BrewManNH Posted April 30, 2013 Share Posted April 30, 2013 If you use the same start and finish coordinates, you can effectively search for one pixel, unless it requires different numbers for the bottom/right parameters. Even if it does, you can always just search x+1 and y+1 to do the same thing. If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag GudeHow to ask questions the smart way! I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from. Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays. - ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script. - Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label. - _FileGetProperty - Retrieve the properties of a file - SciTE Toolbar - A toolbar demo for use with the SciTE editor - GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI. - Latin Square password generator Link to comment Share on other sites More sharing options...
iamtheky Posted April 30, 2013 Author Share Posted April 30, 2013 (edited) Thanks, all the images are 320x240 (im assuming it is just compressed on upload), this is the completed number detection portion. expandcollapse popup#include <GDIPlus.au3> $sv_ImageSource = @ScriptDir & "\88.bmp" _GDIPlus_Startup() $hImage = _GDIPlus_ImageLoadFromFile($sv_ImageSource) $Left = "LEFT NUMBER" $Right = "RIGHT NUMBER" $LTL = 0 $LBL = 0 $LTR = 0 $LBR = 0 $LTOP = 0 $LMID = 0 $LBOT = 0 $RTL = 0 $RBL = 0 $RTR = 0 $RBR = 0 $RTOP = 0 $RMID = 0 $RBOT = 0 If _GDIPlus_BitmapGetPixel($hImage, 54, 107) > 0x6f6f6f Then $LTL = 1 If _GDIPlus_BitmapGetPixel($hImage, 37, 162) > 0x6f6f6f Then $LBL = 1 If _GDIPlus_BitmapGetPixel($hImage, 115, 111) > 0x6f6f6f Then $LTR = 1 If _GDIPlus_BitmapGetPixel($hImage, 101, 164) > 0x6f6f6f Then $LBR = 1 If _GDIPlus_BitmapGetPixel($hImage, 88, 86) > 0x6f6f6f Then $LTOP = 1 If _GDIPlus_BitmapGetPixel($hImage, 76, 135) > 0x6f6f6f Then $LMID = 1 If _GDIPlus_BitmapGetPixel($hImage, 60, 188) > 0x6f6f6f Then $LBOT = 1 If _GDIPlus_BitmapGetPixel($hImage, 185, 111) > 0x6f6f6f Then $RTL = 1 If _GDIPlus_BitmapGetPixel($hImage, 172, 162) > 0x6f6f6f Then $RBL = 1 If _GDIPlus_BitmapGetPixel($hImage, 246, 112) > 0x6f6f6f Then $RTR = 1 If _GDIPlus_BitmapGetPixel($hImage, 236, 164) > 0x6f6f6f Then $RBR = 1 If _GDIPlus_BitmapGetPixel($hImage, 221, 86) > 0x6f6f6f Then $RTOP = 1 If _GDIPlus_BitmapGetPixel($hImage, 211, 136) > 0x6f6f6f Then $RMID = 1 If _GDIPlus_BitmapGetPixel($hImage, 198, 187) > 0x6f6f6f Then $RBOT = 1 ;Left If $LTL = 0 And $LBL = 0 And $LTR = 1 And $LBR = 1 And $LTOP = 0 And $LMID = 0 And $LBOT = 0 Then $Left = "1" If $LTL = 0 And $LBL = 1 And $LTR = 1 And $LBR = 0 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "2" If $LTL = 0 And $LBL = 0 And $LTR = 1 And $LBR = 1 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "3" If $LTL = 1 And $LBL = 0 And $LTR = 1 And $LBR = 1 And $LTOP = 0 And $LMID = 1 And $LBOT = 0 Then $Left = "4" If $LTL = 1 And $LBL = 0 And $LTR = 0 And $LBR = 1 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "5" If $LTL = 1 And $LBL = 1 And $LTR = 0 And $LBR = 1 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "6" If $LTL = 0 And $LBL = 0 And $LTR = 1 And $LBR = 1 And $LTOP = 1 And $LMID = 0 And $LBOT = 0 Then $Left = "7" If $LTL = 1 And $LBL = 1 And $LTR = 1 And $LBR = 1 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "8" If $LTL = 1 And $LBL = 0 And $LTR = 1 And $LBR = 1 And $LTOP = 1 And $LMID = 1 And $LBOT = 1 Then $Left = "9" ;Right If $RTL = 0 And $RBL = 0 And $RTR = 1 And $RBR = 1 And $RTOP = 0 And $RMID = 0 And $RBOT = 0 Then $Right = "1" If $RTL = 0 And $RBL = 1 And $RTR = 1 And $RBR = 0 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "2" If $RTL = 0 And $RBL = 0 And $RTR = 1 And $RBR = 1 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "3" If $RTL = 1 And $RBL = 0 And $RTR = 1 And $RBR = 1 And $RTOP = 0 And $RMID = 1 And $RBOT = 0 Then $Right = "4" If $RTL = 1 And $RBL = 0 And $RTR = 0 And $RBR = 1 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "5" If $RTL = 1 And $RBL = 1 And $RTR = 0 And $RBR = 1 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "6" If $RTL = 0 And $RBL = 0 And $RTR = 1 And $RBR = 1 And $RTOP = 1 And $RMID = 0 And $RBOT = 0 Then $Right = "7" If $RTL = 1 And $RBL = 1 And $RTR = 1 And $RBR = 1 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "8" If $RTL = 1 And $RBL = 0 And $RTR = 1 And $RBR = 1 And $RTOP = 1 And $RMID = 1 And $RBOT = 1 Then $Right = "9" MsgBox(0,'',$Left & $Right) Func _GDIPlus_BitmapGetPixel($hBitmap, $iX, $iY) Local $tArgb, $pArgb, $aRet $tArgb = DllStructCreate("dword Argb") $pArgb = DllStructGetPtr($tArgb) $aRet = DllCall($ghGDIPDll, "int", "GdipBitmapGetPixel", "hwnd", $hBitmap, "int", $iX, "int", $iY, "ptr", $pArgb) Return "0x" & Hex(DllStructGetData($tArgb, "Argb"), 6) EndFunc Edited April 30, 2013 by boththose ,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-. |(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/ (_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_) | | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) ( | | | | |)| | \ / | | | | | |)| | `--. | |) \ | | `-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_| '-' '-' (__) (__) (_) (__) 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