Nick,
perhaps I dont understand what your wanting, but, why not just make your self a "G-code Processing" button. In this button put some VB script to open a teach file, then put in the code to get a g code file, then in that script have an append command, and the append will put in your macro, and post a m30 after it. and repost the file to mach with you added in macro.
Scott