Masheen Posted April 20, 2016 Share Posted April 20, 2016 Hi forum. Any body know hot to do PixelParten search? maybe it call PixelMatrix, PixelArray, StringPixel? I need to search string of pixel first Red second Green, third Yellow. I meen like screenshot. Link to comment Share on other sites More sharing options...
JohnOne Posted April 20, 2016 Share Posted April 20, 2016 PixelSearch(red) PixelGetColor(RedXpos + 1) PixelGetColor(RedXpos + 2) Test them. Rinse and repeat. 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...
JohnOne Posted April 20, 2016 Share Posted April 20, 2016 (edited) I seen a function on the internet somewhere the other day, which would seem to fit your needs, I'll try to find it again. EDIT: Actually it was pixelchecksumsearch. http://autoitcoding.boards.net/thread/10/search-screen-pixel-checksum You could alter it to fit your needs, or just get a checksum of red green yellow and pass that to it. Edited April 20, 2016 by JohnOne 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, JohnOne said: I seen a function on the internet somewhere the other day, which would seem to fit your needs, I'll try to find it again. I need a sample of code. if you can find I'll thank you. Link to comment Share on other sites More sharing options...
JohnOne Posted April 20, 2016 Share Posted April 20, 2016 There is a link above. 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, JohnOne said: There is a link above. I don't understand how to write in AutoIt. It will be each time to find the first red square in the upper left corner Link to comment Share on other sites More sharing options...
JohnOne Posted April 20, 2016 Share Posted April 20, 2016 Start at help file. expandcollapse popupOpt("PixelCoordMode", 1) HotKeySet("{Esc}", "_Exit") $__x = 43 $__y = 156 $__width = 10 $__height = 10 Sleep(3000) $col = PixelGetColor($__x, $__y) ;Get top left color or checksum area $sum = PixelChecksum($__x, $__y, $__x + $__width, $__y + $__height) ; Get checksum of area $timer = TimerInit() _PictureSearch($col, $sum) $time = TimerDiff($timer) ConsoleWrite($time & @LF) Func _PictureSearch($Color, $Checksum) $iX = @DesktopWidth $iY = @DesktopHeight $myY = 0 Do $aPos = PixelSearch(0, $myY, $iX, $iY, $Color) If IsArray($aPos) Then If PixelChecksum($aPos[0], $aPos[1], $aPos[0] + 10, $aPos[1] + 10) = $Checksum Then MouseMove($aPos[0], $aPos[1], 0) Sleep(1000) ; Just to show it working EndIf _SearchX($aPos[0], $aPos[1]) $myY = $aPos[1] + 1 Else $myY = @DesktopHeight EndIf Until $myY >= @DesktopHeight EndFunc ;==>_PictureSearch Func _SearchX($X, $Y) Local $a Do $a = PixelSearch($X + 1, $Y, @DesktopWidth, $Y, $col) If IsArray($a) Then $X = $a[0] If PixelChecksum($a[0], $a[1], $a[0] + 10, $a[1] + 10) = $sum Then MouseMove($a[0], $a[1], 0) EndIf Else $X = @DesktopWidth EndIf Until $X >= @DesktopWidth EndFunc ;==>_SearchX Func _Exit() Exit EndFunc ;==>_Exit 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, JohnOne said: Start at help file. expandcollapse popupOpt("PixelCoordMode", 1) HotKeySet("{Esc}", "_Exit") $__x = 43 $__y = 156 $__width = 10 $__height = 10 Sleep(3000) $col = PixelGetColor($__x, $__y) ;Get top left color or checksum area $sum = PixelChecksum($__x, $__y, $__x + $__width, $__y + $__height) ; Get checksum of area $timer = TimerInit() _PictureSearch($col, $sum) $time = TimerDiff($timer) ConsoleWrite($time & @LF) Func _PictureSearch($Color, $Checksum) $iX = @DesktopWidth $iY = @DesktopHeight $myY = 0 Do $aPos = PixelSearch(0, $myY, $iX, $iY, $Color) If IsArray($aPos) Then If PixelChecksum($aPos[0], $aPos[1], $aPos[0] + 10, $aPos[1] + 10) = $Checksum Then MouseMove($aPos[0], $aPos[1], 0) Sleep(1000) ; Just to show it working EndIf _SearchX($aPos[0], $aPos[1]) $myY = $aPos[1] + 1 Else $myY = @DesktopHeight EndIf Until $myY >= @DesktopHeight EndFunc ;==>_PictureSearch Func _SearchX($X, $Y) Local $a Do $a = PixelSearch($X + 1, $Y, @DesktopWidth, $Y, $col) If IsArray($a) Then $X = $a[0] If PixelChecksum($a[0], $a[1], $a[0] + 10, $a[1] + 10) = $sum Then MouseMove($a[0], $a[1], 0) EndIf Else $X = @DesktopWidth EndIf Until $X >= @DesktopWidth EndFunc ;==>_SearchX Func _Exit() Exit EndFunc ;==>_Exit Don't know how it can be useful to me . Can you explain in more detail ? Link to comment Share on other sites More sharing options...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, JohnOne said: Can you help me and edit this code? Link to comment Share on other sites More sharing options...
BrewManNH Posted April 20, 2016 Share Posted April 20, 2016 1 hour ago, Masheen said: Don't know how it can be useful to me . Can you explain in more detail ? Sounds more like "Can you write this for me because I don't want to learn how to do it for myself." 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, BrewManNH said: Sounds more like "Can you write this for me because I don't want to learn how to do it for myself." no it is not true. Maybe other solution will be usefull and understandble for me Link to comment Share on other sites More sharing options...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 1 hour ago, BrewManNH said: Sounds more like "Can you write this for me because I don't want to learn how to do it for myself." yesterday you give me right way in my question and I was able to understand Link to comment Share on other sites More sharing options...
Bert Posted April 20, 2016 Share Posted April 20, 2016 Before we go further - this isn't for a game is it? If it is, then understand that is against forum rules. If it isn't, then there is many better ways to hook into controls than to use pixel search. You have pictures of what you want to look for but the links are broken. Also, you make want to look here on learning to code in AutoIt. This will really help you in understanding what we are telling you. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
JohnOne Posted April 20, 2016 Share Posted April 20, 2016 If you have scite in full screen, and run this code from it, it should find the scite icon. if there were 20 scite icons it would find them all. You can figure out how to adapt it to your needs, and if you cannot, you are not ready to even try to write the code you want to. I took replaced some magic numbers from original linked code. expandcollapse popupOpt("PixelCoordMode", 1) HotKeySet("{Esc}", "_Exit") ;Sleep(3000) ; Here you define the screen position of a known image ; The image can be 1x1 pixels if you like $__x = 10 $__y = 10 $__width = 10 $__height = 10 Sleep(3000) ; This part of code is getting the top left pixel color ; and the checksum of the above defined area $col = PixelGetColor($__x, $__y) ;Get top left color of checksum area $sum = PixelChecksum($__x, $__y, $__x + $__width, $__y + $__height) ; Get checksum of area ; Here is the simple example $timer = TimerInit() _PictureSearch($col, $sum) $time = TimerDiff($timer) ConsoleWrite($time & @LF) Func _PictureSearch($Color, $Checksum) $iX = @DesktopWidth $iY = @DesktopHeight $myY = 0 Do $aPos = PixelSearch(0, $myY, $iX, $iY, $Color) If IsArray($aPos) Then If PixelChecksum($aPos[0], $aPos[1], $aPos[0] + $__width, $aPos[1] + $__height) = $Checksum Then MouseMove($aPos[0], $aPos[1], 0) Sleep(1000) ; Just to show it working EndIf _SearchX($aPos[0], $aPos[1]) $myY = $aPos[1] + 1 Else $myY = @DesktopHeight EndIf Until $myY >= @DesktopHeight EndFunc ;==>_PictureSearch Func _SearchX($X, $Y) Local $a Do $a = PixelSearch($X + 1, $Y, @DesktopWidth, $Y, $col) If IsArray($a) Then $X = $a[0] If PixelChecksum($a[0], $a[1], $a[0] + $__width, $a[1] + $__height) = $sum Then MouseMove($a[0], $a[1], 0) EndIf Else $X = @DesktopWidth EndIf Until $X >= @DesktopWidth EndFunc ;==>_SearchX Func _Exit() Exit EndFunc ;==>_Exit 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 3 hours ago, JohnOne said: If you have scite in full screen, and run this code from it, it should find the scite icon. if there were 20 scite icons it would find them all. You can figure out how to adapt it to your needs, and if you cannot, you are not ready to even try to write the code you want to. I took replaced some magic numbers from original linked code. expandcollapse popupOpt("PixelCoordMode", 1) HotKeySet("{Esc}", "_Exit") ;Sleep(3000) ; Here you define the screen position of a known image ; The image can be 1x1 pixels if you like $__x = 10 $__y = 10 $__width = 10 $__height = 10 Sleep(3000) ; This part of code is getting the top left pixel color ; and the checksum of the above defined area $col = PixelGetColor($__x, $__y) ;Get top left color of checksum area $sum = PixelChecksum($__x, $__y, $__x + $__width, $__y + $__height) ; Get checksum of area ; Here is the simple example $timer = TimerInit() _PictureSearch($col, $sum) $time = TimerDiff($timer) ConsoleWrite($time & @LF) Func _PictureSearch($Color, $Checksum) $iX = @DesktopWidth $iY = @DesktopHeight $myY = 0 Do $aPos = PixelSearch(0, $myY, $iX, $iY, $Color) If IsArray($aPos) Then If PixelChecksum($aPos[0], $aPos[1], $aPos[0] + $__width, $aPos[1] + $__height) = $Checksum Then MouseMove($aPos[0], $aPos[1], 0) Sleep(1000) ; Just to show it working EndIf _SearchX($aPos[0], $aPos[1]) $myY = $aPos[1] + 1 Else $myY = @DesktopHeight EndIf Until $myY >= @DesktopHeight EndFunc ;==>_PictureSearch Func _SearchX($X, $Y) Local $a Do $a = PixelSearch($X + 1, $Y, @DesktopWidth, $Y, $col) If IsArray($a) Then $X = $a[0] If PixelChecksum($a[0], $a[1], $a[0] + $__width, $a[1] + $__height) = $sum Then MouseMove($a[0], $a[1], 0) EndIf Else $X = @DesktopWidth EndIf Until $X >= @DesktopWidth EndFunc ;==>_SearchX Func _Exit() Exit EndFunc ;==>_Exit Thanks I looked at the example, I opened a Pain and created a lot of pixels at row (red, yellow, green), and multiplied them throughout the document. And in the macro indicated the coordinate of the first red pixel followed by the desired color and indicated a width of 3 pixels and a height of 1 pixel. For a long time but he found them all. now I can't figure out how to putt him what he needs to look for being put into this checksum has these colors in this sequence xy(0.1)Red xy(0.2)Yellow xy(0.3)Green Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted April 20, 2016 Moderators Share Posted April 20, 2016 Masheen, When you reply, please use the "Reply to this topic" button at the top of the thread or the "Reply to this topic" editor at the bottom rather than the "Quote" button - we know what we wrote and it just pads the thread unnecessarily. Thanks in advance for your cooperation. 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...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 Thanks I looked at the example, I opened a Pain and created a lot of pixels at row (red, yellow, green), and multiplied them throughout the document. And in the macro indicated the coordinate of the first red pixel followed by the desired color and indicated a width of 3 pixels and a height of 1 pixel. For a long time but he found them all. now I can't figure out how to putt him what he needs to look for being put into this checksum has these colors in this sequence xy(0.1)Red xy(0.2)Yellow xy(0.3)Green Link to comment Share on other sites More sharing options...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 Maybe like that. Plz amend and correct me $aPosRed= PixelSearch(0, 0, @DesktopWidth,@DesktopHeight, 0xRed) if IsArray($aPosRed) Then $aPosYellow=PixelSearch($aPosRed[0]+1,$aPosRed[1],$aPosRed[0]+1,$aPosRed[1, 0xYellow) If IsArray($aPosYellow) Then $aPosGreen=PixelSearch($aPosYellow[0]+1,$aPosYellow[1],$aPosYellow[0]+1,$aPosYellow[1, 0xGreen) If IsArray($aPosYellow) Then MsgBox(0,"","GOOD") EndIf EndIf EndIf Link to comment Share on other sites More sharing options...
Bert Posted April 20, 2016 Share Posted April 20, 2016 are you using excel or google docs? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Masheen Posted April 20, 2016 Author Share Posted April 20, 2016 ok thx all. its work. I create in paint RedYellowGreen pixel row and do it code its find/ Thx all for help. By the way how i can edit my posts? $myX=0 $myY=0 Do $aPosRed = PixelSearch(0, 260, @DesktopWidth,260, 0xED1C24) if IsArray($aPosRed) Then $aPosYellow = PixelSearch($aPosRed[0]+1,$aPosRed[1],$aPosRed[0]+1,$aPosRed[1], 0xFFF200) If IsArray($aPosYellow) Then $aPosGreen = PixelSearch($aPosYellow[0]+1,$aPosYellow[1],$aPosYellow[0]+1,$aPosYellow[1], 0x22B14C) If IsArray($aPosGreen) Then MsgBox(0,"","GOOD") EndIf EndIf EndIf $myX=$myX+1 $myY=$myY+1 Until $myX=@DesktopWidth 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