Markus1971 Posted October 29, 2021 Posted October 29, 2021 I am near to brain collaps.... Ok, here is what i try : I have a Pixelsearch on a little part of the screen. This Pixels can be red or green. As long as i detect red or green pixels in this area everything is OK. But when nither red or green is found i want to execute a function. This is what i tryed : expandcollapse popupGlobal $iTellme = 1 While 1 reader() Alert() $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Func reader() $ColVarread = GUICtrlRead($ColVar) $iSearchpoint = GUICtrlRead($Eper) $aEcoord = PixelSearch(465, $iSearchpoint, 468, $iSearchpoint + 1, 0xFF2020, 200) If IsArray($aEcoord) = True Then GUICtrlSetBkColor($List1, 0xFF2020) GUICtrlSetData($List1, "") GUICtrlSetData($List1, "Red") ConsoleWrite("Red found" & @CRLF) $iTellme = 0 Else $aEcoord = PixelSearch(465, $iSearchpoint, 468, $iSearchpoint + 1, 0x20FF20, 200) If IsArray($aEcoord) = True Then GUICtrlSetBkColor($List1, 0x20FF20) GUICtrlSetData($List1, "") GUICtrlSetData($List1, "Green") ConsoleWrite("Green found" & @CRLF) $iTellme = 0 EndIf EndIf EndFunc Func Alert() If $iTellme = 1 Then GUICtrlSetData($List1, "") GUICtrlSetData($List1, "ALARM") Send ("A") Sleep(1500) EndIf EndFunc So far my thoughts.... The $iTellme is set global to 1. As long as i find red or green pixels in the area everything is fine and $iTellme will be set to 0 and the function Alert will do nothing. But if no red or green pixels are found, $iTellme will stay 1 and the Function Alert will do its job... But o have no idea why all this is not working at all. Sometimes Alert is executed no matter what or, when i try something else, it is not executed at all.... Where is my error ?
Developers Jos Posted October 29, 2021 Developers Posted October 29, 2021 You set the Global variable $iTellme to 0 whenever one is found but never set it to 1 again. so what about you do that before your color tests? Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
Markus1971 Posted October 29, 2021 Author Posted October 29, 2021 Hi Jos, that was my attemp #102..... I set the Var to 1 again right at the end of the Alarm-Func .... and then i had the weired problem that the routine got stuck at the reader function and the prog stopped working... believe me... i tryed so many variants like Chase, Select etc.... Maybe my next try will be to do a function for every single Pixelsearch, set Vars and at the end look up the Vars and execute functions according.
Nine Posted October 30, 2021 Posted October 30, 2021 Impossible to say without a full replicable snippet code. ps. use Ctrl+T to indent properly your code “They did not know it was impossible, so they did it” ― Mark Twain Spoiler Block all input without UAC Save/Retrieve Images to/from Text Monitor Management (VCP commands) Tool to search in text (au3) files Date Range Picker Virtual Desktop Manager Sudoku Game 2020 Overlapped Named Pipe IPC HotString 2.0 - Hot keys with string x64 Bitwise Operations Multi-keyboards HotKeySet Recursive Array Display Fast and simple WCD IPC Multiple Folders Selector Printer Manager GIF Animation (cached) Debug Messages Monitor UDF Screen Scraping Round Corner GUI UDF Multi-Threading Made Easy Interface Object based on Tag
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