Do
/ac "Spellname" <t>
You HAVE to do the <t> (attack target) or it won't work. Well, at least it would never for me. Then it will just cast the action on the enemy you are currently targetting.