Search the Community
Showing results for tags 'faulty'.
-
Hi all, I'm going crazy while I try and work out why a fairly simply if condition isn't working. I will try and explain it clearly, in the hope someone can find out the cause. The portion of the script for these if conditions is copied in below. The first PixelGetColor func is denoted in Screenshot 1, the RED dot signifies where the color is extracted from. The second PixelGetColor func is denoted in Screenshot 2, the YELLOW dot signifies where the color is extracted from. The script is tested for 3 scenarios, where 1. no resource is found (Screenshot 1), 2. multiple resources are found (Screenshot 2), and 3. only 1 resource is found (Screenshot 3). This application is being run via RDP hence I can't access the controls, and therefore relying on the pixel colours. The issue is, for all three scenarios, only the first If condition's first result is shown, even though the actual program shows the 3 screenshots for each of the three scenarios. Any ideas where I'm going wrong? If PixelGetColor(697, 446, 0xF0F0F0) Then ;If resource is not found, cancel out Sleep(200) MsgBox(64, 'Error', 'Resource is not found, therefore this pool will not be saved and will cancel out. Click OK to continue.') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Fail', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Resource not found. ' & $Notes, 'J' & $ColumnIRow) Sleep(500) WinActivate('Scheduling Help') Sleep(500) Send('{ENTER}') ;Click OK Sleep(500) Send('{SHIFTDOWN}{TAB}{SHIFTUP}{ENTER}') ;Click Cancel Sleep(500) Send('{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}') ;Click Close Sleep(500) WinActivate('Scheduling: DB Flex Rule Tool - Inbox Pool Routing') Sleep(500) Send('{TAB}{ENTER}') ;Click Yes Sleep(500) WinActivate('Rules for Pool') Sleep(500) Send('{TAB}{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) MouseClick('Primary', 1259, 653, 1) ;Click Cancel Else Send('{TAB}{TAB}{DOWN}') ;Find resource If PixelGetColor(725, 383, 0x3399FF) Then ;If there are multiple resources, cancel out Sleep(200) MsgBox(64, 'Error', 'There are multiple resources, therefore this pool will not be saved and will cancel out. Click OK to continue.') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Redo', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Multiple resources. ' & $Notes, 'J' & $ColumnIRow) Sleep(500) WinActivate('Scheduling Help') Sleep(500) Send('{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) Send('{SHIFTDOWN}{TAB}{TAB}{TAB}{TAB}{SHIFTUP}{ENTER}') ;Click Close Sleep(500) WinActivate('Scheduling: DB Flex Rule Tool - Inbox Pool Routing') Sleep(500) Send('{TAB}{ENTER}') ;Click Yes Sleep(500) WinActivate('Rules for Pool') Sleep(500) Send('{TAB}{TAB}{TAB}{ENTER}') ;Click Cancel Sleep(500) MouseClick('Primary', 1259, 653, 1) ;Click Cancel Else ;Select the resource Send('{ENTER}') ;Select Order Physician MsgBox(0, '', 'save button clicks now') _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Complete', 'I' & $ColumnIRow) _Excel_RangeWrite($oWorkbook, 'CHFT Pools & RTE Rules', 'Success. ' & $Notes, 'J' & $ColumnIRow) ;Send('{TAB}{TAB}{TAB}{TAB}{TAB}{TAB}{ENTER}') ;Click Save EndIf EndIf