Added batch support with json config and macros

Will probably be switching over to config based running exclusively but
need to test it a bit more and update the documentation first.
Also added support for macros for repeated logic. It was a side affect
of one to the other batch interfaces I was trying but seemed useful so
I left it.