appleTV macro question

Is there a way to automate connecting/disconnecting to appleTV