Have some dumb code of mine from 2009:
I wouldn't do it this way in any means (I mean, the coding really horrible and the method is ... yeah) but you should get the idea of a simple "check if pixel *** has color *** and do something".
If you know something about memory hacking you could check for a value (probably boolean) that indicates wheter or not you're hovering an enemy. You might want inject some .dll and let it call the function (or jump to the code) that is called when you "shoot" or simply imitate a shot.
But since you asked this in AutoIt section I guess the first way will be within your means.