Hyflex Posted March 26, 2012 Share Posted March 26, 2012 (edited) I have four pixelsearchs what I need any 3 or more to exist before it actually does something otherwise it needs to do nothing.. $COpenTopBlack = PixelSearch(105, 792, 105, 792, 0x010101, 2) $COpenTopBrown = PixelSearch(105, 793, 105, 793, 0x594838, 2) $COpenBottomBlack = PixelSearch(105, 814, 105, 814, 0x010101, 2) $COpenBottomBlack = PixelSearch(105, 813, 105, 813, 0x594838, 2) Usually I would do something like this: $COpenBottomBlack = PixelSearch(105, 813, 105, 813, 0x594838, 2) If Not @error Then ;Do stuff here if COpen Black is found Else ; Do nothing as COpen Black was not found EndIf However I'm not sure how to make it work so it requires 3 of them to return true before doing stuff.. Any help would be appreciated. Edited March 26, 2012 by XxXGoD Link to comment Share on other sites More sharing options...
Command3r Posted March 26, 2012 Share Posted March 26, 2012 try this " @error = 0 " hope this helps $COpenBottomBlack = PixelSearch(105, 813, 105, 813, 0x594838, 2) If @error = 0 Then MsgBox(64, "Check", "there's no errors :D") Else MsgBox(16, "Check", "There's an error :(") EndIf [font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting. [font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color] [font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font] Link to comment Share on other sites More sharing options...
Hyflex Posted March 26, 2012 Author Share Posted March 26, 2012 try this " @error = 0 " hope this helps $COpenBottomBlack = PixelSearch(105, 813, 105, 813, 0x594838, 2) If @error = 0 Then MsgBox(64, "Check", "there's no errors :D") Else MsgBox(16, "Check", "There's an error :(") EndIf That works exactly how my other script works, I'm trying to make it so if two of the searchs return 0 and two return 1 then it doesn't run, but if it returns three or four 0's then it runs. Link to comment Share on other sites More sharing options...
Command3r Posted March 26, 2012 Share Posted March 26, 2012 I can't solve it , sorry.. wait other users to help you [font="arial, helvetica, sans-serif;"]Advice for you[/font][font="arial, helvetica, sans-serif;"]: [/font][u]Search[/u] before posting. [font="arial, helvetica, sans-serif;"] *********** Problem solved? if yes [/font][color=rgb(0,0,0);font-family:arial, helvetica, sans-serif;] *********[/color] [font="arial, helvetica, sans-serif;"]******* press "Mark Solved" button. *******[/font] Link to comment Share on other sites More sharing options...
Hyflex Posted March 26, 2012 Author Share Posted March 26, 2012 I can't solve it , sorry.. wait other users to help you It's cool thanks for having a look, hopefully someone can. Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 26, 2012 Moderators Share Posted March 26, 2012 XxXGoD, I'm not sure how to make it work so it requires 3 of them to return true before doing stuffIf you only want to find any 3 of the 4 then you could do something like this: $iCount = IsArray(_PixelSearch(coord1...)) + IsArray(_PixelSearch(coord2...)) + IsArray(_PixelSearch(coord3...)) + IsArray(_PixelSearch(coord4...)) If $iCount > 2 Then ; Code for 3 or 4 found Else ; Code for 0, 1, or 2 found EndIf Any help? M23 Command3r 1 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...
Hyflex Posted March 26, 2012 Author Share Posted March 26, 2012 Thanks M23, that works perfectly I have another PixelSearch question. If I have a start position of: 130, 100 and an end position of 170, 100 I want to adjust alone the area with a percent... so if I set $VPercent = 30% it would use the coordinates: 145,100 How is this achievable? Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted March 26, 2012 Moderators Share Posted March 26, 2012 XxXGoD, Basic maths? expandcollapse popup#include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <WinAPI.au3> Global $iRange = 40, $iStart = 130 $hGUI = GUICreate("Test", 500, 500) $cSlider = GUICtrlCreateSlider(10, 10, 200, 20) $hSlider = GUICtrlGetHandle($cSlider) GUICtrlCreateLabel("Percent:", 10, 40, 80, 20) $cLabel_1 = GUICtrlCreateLabel(0, 90, 40, 200, 20) GUICtrlCreateLabel("Delta:", 10, 70, 80, 20) $cLabel_2 = GUICtrlCreateLabel(0, 90, 70, 200, 20) GUICtrlCreateLabel("Search 130 to", 10, 100, 80, 20) $cLabel_3 = GUICtrlCreateLabel("", 90, 100, 100, 20) GUISetState() GUIRegisterMsg($WM_HSCROLL, "_WM_HSCROLL") While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func _WM_HSCROLL($hWnd, $iMsg, $wParam, $lParam) #forceref $hWnd, $iMsg If $lParam = $hSlider Then If _WinAPI_LoWord($wParam) = 5 Then ;$SB_THUMBTRACK $iPercent = GUICtrlRead($cSlider) GUICtrlSetData($cLabel_1, $iPercent) $iDelta = Int($iRange * $iPercent / 100) GUICtrlSetData($cLabel_2, $iDelta) GUICtrlSetData($cLabel_3, $iStart + $iDelta) EndIf EndIf Return $GUI_RUNDEFMSG EndFunc ;==>_WM_HSCROLL 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...
Hyflex Posted March 26, 2012 Author Share Posted March 26, 2012 Oh dang, that is simple. I got it all working perfectly now. Thanks a lot M23 (btw your script doesn't work right if you use mwheel) 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