Hunter macro help

I am looking to add in the ability to, at the minimum, re call my pet from a target that he is attacking.
I am currently using:
/cast Hunter's Mark
/script PetAttack(target);
how would I add in a pet passive command that wont confuse the system?
also, would there be a way to add in a pet revive command like in:
/cast [@pet,dead][mod:shift] Revive Pet
/cast [nopet,nomod] Call Pet 1
/clearfocus [@focus,dead]
/focus [@focus,exists]player;target
/clearfocus [@focus,noharm]
/petattack [@focus,exists]
/petfollow [@focus,noexists]
/cast Hunter's Mark
for whatever reason I cannot seem to get the above to work at all and cant figure why but may have somthing to do with one being a /script with a ; at the end. its just been forever since Ive written any macros for the game myself and am super rusty.
I am currently using:
/cast Hunter's Mark
/script PetAttack(target);
how would I add in a pet passive command that wont confuse the system?
also, would there be a way to add in a pet revive command like in:
/cast [@pet,dead][mod:shift] Revive Pet
/cast [nopet,nomod] Call Pet 1
/clearfocus [@focus,dead]
/focus [@focus,exists]player;target
/clearfocus [@focus,noharm]
/petattack [@focus,exists]
/petfollow [@focus,noexists]
/cast Hunter's Mark
for whatever reason I cannot seem to get the above to work at all and cant figure why but may have somthing to do with one being a /script with a ; at the end. its just been forever since Ive written any macros for the game myself and am super rusty.