You shouldn't order them to "attach archers" , as this will make the charge them to kill them in melee.
Better order them to "fire at: archers". They will switch to another target ( : nearest) as soon as there is no more valid pre-set target, e.g. no archers, or all enemy archers routing.
__________________
As for AI the most effective work around to this problem so far is to simply use an American instead, they tend to put up a bit more of a fight than your average Artificial Idiot. ... James McGuigan on rec.games.computer.stars somewhen back in 1998 ...