This macro is written for shackles but can be modified for anything you need to have focus on.
#showtooltip
/clearfocus [modifier:alt]
/focus [target=focus,noexists]; [target=focus,dead]
/clearfocus [target=focus,help]
/cast [target=focus,exists,harm] Shackle Undead(Rank 3); Shackle...