Reading current rendering frame

Hi,

I have a question about the current frame and pre-render script.

Basically, I would like to have the output file named by the scene material (VraySwitchMtl), which is animated. So, the output file name would be something like:
“Chair” + <VraySwitchMtl.index[currentFrame]>.

This setup only works for the current frame that is shown in the timeline. I would like to read the current render frame number to achieve full functionality.

I think this idea would be useful for product rendering with material variations. Each file output would be named based on the material name, which is driven by the rendering frame integer. This way, file naming will be controlled by the frame number, rather than creating a separate setup for each material variation.

Any suggestions would be appreciated.

Thanks.