You don't need a macro to make a pet switch targets. Simply target something and use the standard "obey" action.