This is not a issue of mel, but a issue of not knowing the execution environment.
Usually high mel skill is to know how connections work, just like good api skills is to know hoe mel works, and good node deign skill is knowing what humans do.
hmm... yes (tough not form that slot) but in not sure how to do that with minimal effort in way thats actually safe for a wider environment. Since i don't know your pipe I cant say for sure either. I would need to decree some sert fo boundary rules to your entire production staff for a fool proof solution. Or use the api.
Neither of which are easy in this context as i cant know your execution environment
For example you may want to be fancy and register a new render procedure xml for render or edit the mayaBatchRenderProcedure.mel* etc etc..
- mayaBatchRenderProcedure.mel is the main loop of a render.