For an easier and more advanced Version i would use:


/cast [target=focustarget,harm,exists,nodead] Auto Shot


hope its helps...