Well you could try detecting orders? I mean it will be flawed but it might work for some basic orders?
What you could do is add an if with the condition <unit> order = "<order>", and then set unit animation <dummy> <corresponding animation>.
So lets say if the order id is "move" you play the walk animation, if its "holdground" you play the "stand" animation.
The problem arouses with attacking, "smart", and spells.
When you tell a unit to "attackmove" you can play the move animation, but when you issue order "attack" you could be attacking or still moving. You could then detect if there are enemy units in a range of 100 ( for melee ) and if there are play animation "attack".
For smart orders your unit will probably be moveing or attacking most of the time so just do the same as you would with attack.
Now if your order is not equal to any of the basic ones ( move, attack, stop, patrol ) play the spell animation.
Like I said this is flawed but it might just work.
And most of the id strings in this post are wrong ( i think ).
- Hope this helps...