Thanks Josh, but that doesnt work either, its querying the RenderSetup Widget Configuration.
What im asking is to be notified of the render layer name when it is actually being rendered in batch process, therefore, independent from the main thread and GUI.
This is kind of a very specific geeky question.
Im having a bad time looking for answers as there apparently isnt a proper documentation about the mel scripts options in the render options tabs.
Just to explain a little bit more: the reason why it must be done via a preRenderLayerMel script in the render options tabs is because those are callbacks called by the rendering process at the moment of effectively proceeding the render (be it the layer, in pre/post, each frame in pre/post or the whole rendering process). I dont want to query the RenderSetup or the Legacy Render Layer system is this is the Configuration you have just set up BEFORE starting to render....
The render layer name (among other layer parameters) must be able to be queried from the render options tabs pre/post RenderLayer Mel since this is a script that is called when starting/finishing to process each render layer! It just must be available somehow.
Either there is a huge lack of documentation about the render options, or it is explained in a very hidden spot. Im guessing the first one!