StiveMox Posted August 15, 2011 Share Posted August 15, 2011 How to know if this image there are the following colors: ff0f0f, ff860f, 601b5c.And return if the image is valid or not.Recalling that the image is only valid if there cited these colors. Link to comment Share on other sites More sharing options...
monoscout999 Posted August 15, 2011 Share Posted August 15, 2011 The image is in a GUI or in a file? case GUI PixelGetColor() function will do the job case File What format is the file case BMP Theres a BMP library somewhere in the forum that is very simply and use only AutoIt native Functions case else You will need some GDI+ functions for that but again this was already done somewhere in the forum Return "done" Link to comment Share on other sites More sharing options...
StiveMox Posted August 15, 2011 Author Share Posted August 15, 2011 This is a file in jpg. Sometimes a picture is normal, which has several pixels. I think it nescessário pixelsearch use to find these colors in the photo. But the problem is how to find more than one pixel with Pixelsearch. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 15, 2011 Moderators Share Posted August 15, 2011 StiveMox, Search for the first colour. If found, search for the second. If found, search for the third. And so on..... If any colour is not found, you do not have a valid image. 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...
StiveMox Posted August 15, 2011 Author Share Posted August 15, 2011 So does it work? http://pastebin.com/YVNAgHE5 Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 15, 2011 Moderators Share Posted August 15, 2011 StiveMox, So does it work?What kind of question is that? Have you tried it yourself? And next time you want to post code, just put [autoit] before and [/autoit] after the code so it appears in a nice box here on the forum. 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...
StiveMox Posted August 15, 2011 Author Share Posted August 15, 2011 (edited) I was unaware of the code tags to place on the forum. Sorry.Yes I'm trying to do, but I'm beginner and I need help.if PixelSearch($left, $top, $right, $bottom, $color1) and PixelSearch($left, $top, $right, $bottom, $color2) and PixelSearch($left, $top, $right, $bottom, $color1) Then MsgBox(0, "Validation", "Image valid!") EndIf Edited August 15, 2011 by StiveMox Link to comment Share on other sites More sharing options...
monoscout999 Posted August 15, 2011 Share Posted August 15, 2011 I recomend to Post the entire script, because that fragment never will works beacuse the variables $left, $right, etc never were defined in the script. Look in the help file the explain of the function and see the example to look how it work.. another function that you can use is PixelGetColor() If you want to use PixelSearch then you have to define the parameters of the box where the function have to search for. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 15, 2011 Moderators Share Posted August 15, 2011 StiveMox,That will not work because PixelSearch returns an array (look in the Help file for more details). I would do something like this untested):; The return will be the result of the test $fResult = _TestImage($left, $top, $right, $bottom, $color1, $color2, $color3) Func _TestImage($left, $top, $right, $bottom, $color1, $color2, $color3) ; Look for first colour PixelSearch($left, $top, $right, $bottom, $color1) ; If not found then return false If @error Then Return False ; Look for second colour PixelSearch($left, $top, $right, $bottom, $color2) If @error Then Return False ; Look for third colour PixelSearch($left, $top, $right, $bottom, $color3) If @error Then Return False ; We must have found all 3 so return true Return True EndFuncTry that and see how you get on. 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...
StiveMox Posted August 15, 2011 Author Share Posted August 15, 2011 (edited) ;Check if the image exists some colors required. While 1 Sleep(1) WEnd HotKeySet("{q}", "start") ;start the image verification HotKeySet("{w}", "stop") ;close the soft Func start() Dim $coord[4] = [306, 357, 677, 535] Dim $colors[3] = [0xff0f0f, 0xff860f, 0x601b5c] While 2 If PixelSearch($coord[0], $coord[1], $coord[2], $coord[3], $colors[0]) and PixelSearch($coord[0], $coord[1], $coord[2], $coord[3], $colors[1]) Then MsgBox(0, "Image verification", "The image is valid!") EndIf WEnd EndFunc Func stop() Exit EndFunc @Melba23 I will try. Thanks. Edited August 15, 2011 by StiveMox 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