how to write a macro script