A macro to do the things you describe wouldn't be possible with the in-game macro feature as they're limited in length. That means you must be using a third-party tool of some kind which is already a bannable offense on its own regardless of the fact what you suggest is essentially botting.