Sleep(500)
Local $hTrayWnd = WinGetHandle("[CLASS:Shell_TrayWnd]")
Local $hTlb = ControlGetHandle($hTrayWnd, "", "ToolbarWindow324")
If @error Then $hTlb = ControlGetHandle($hTrayWnd, "", "ReBarWindow321")
Local $aWPos = WinGetPos($hTrayWnd)
Local $aTPos = ControlGetPos($hTrayWnd, "", $hTlb)
If @error Or UBound($aTPos) <> 4 Then
Dim $aTPos[5]
$aTPos[4] = @error ; or whatever you decide to do
EndIf
ConsoleWrite($aWPos[0] + $aTPos[0] & "," & $aWPos[1] + $aTPos[1] & "," & $aWPos[0] + $aTPos[0] + $aTPos[2] & "," & $aWPos[1] + $aTPos[1] + $aTPos[3] & @CRLF)
; Find a blue pixel from the autoit icon
Local $aCoord = PixelSearch($aWPos[0] + $aTPos[0], $aWPos[1] + $aTPos[1], $aWPos[0] + $aTPos[0] + $aTPos[2], $aWPos[1] + $aTPos[1] + $aTPos[3], 0x5D83AC)
Local $aCoord = PixelSearch(@DesktopWidth - (@DesktopWidth / 3), @DesktopHeight - 70, @DesktopWidth, @DesktopHeight, 0x5D83AC) ; testing
If Not @error Then
ConsoleWrite("X and Y are: " & $aCoord[0] & "," & $aCoord[1])
MouseMove($aCoord[0], $aCoord[1], 100) ; * <-- for debugging purposes only
Sleep(1000)
EndIf
..when coding, check for @error(s).