Executing scripts with adhoc recording

I would like to execute a script when an ‘adhoc’ or ‘always’ recording starts and ends. I looked at the macro-enable-record macro thinking this was where to do it, but I could not get it working. Perhaps I don’t know how the dial plan and MixMonitor acts when a *1 is pressed.

Any help is appreciated.