What I want to do is... once the mouse is in the area of a moving health bar, autoit pixelsearches a fixed parameters of say 50height x 150length relative to the position of the mouse, for the health bar, once it finds it, the mouse follows the moving bar indefinitely or until the bar disappears, while at the same time, and this is the hard part, clicking in a box right below the moving blue bar. Where the mouse is, is irrelevant, as long as its able to click the box below the bar.
This one has me stomped. Any pros can solve this?
Health Bar Example:

Code:
HotKeySet('{ESC}','_exit')
sleep(2000)
While 1
Global $mouse = MouseGetPos()
$Coord = PixelSearch( $mouse[0]-150, $mouse[1]-45, $mouse[0]+150, $mouse[1]+45, 0x3F48CC, 5, 5) ; Search a blue bar near mouse position
While @error = 0
MouseClick("left",$coord[0]+45,$coord[1]+40)
MouseMove($coord[0], $coord[1], 1)
$Coord = PixelSearch( $mouse[0]-40, $mouse[1]-40, $mouse[0]+40, $mouse[1]+40, 0x3F48CC, 5, 5)
WEnd
sleep(100)
WEnd
Func _exit()
Exit
EndFunc






