Help please,render one object with incremental materials

Hi ! Looooong time ago, a buddy gave me that script to render objects with several material and save the still automatically with a name convention. Ideal for this kind of  routine.
I would like to use it again but it'll be more efficient if Vray frame Buffer,Vray color mapping and max gamma preference could be take into account. I mean, I would like to be able to use fully this script with Vray. My problem is ... I'm not a maxscripter ! and I don't know if there is a easy way to do it... Could you help me ? Thanks.

Here is the script : 

on vasy pressed do
outputpath = GetSavePAth "Sauver dans : "
for obji in objectTorender.selection do
-- print objectTorender.items[obji]
obj = getnodebyname objectTorender.items[obji]
max unhide all
select obj
max hide inv
for dec in $decor do
unhide dec
for mati in matTorender.selection do
obj.material = meditMaterials[mati]
nomobj =
matname =
sortie = outputpath + "\\" + nomobj + "_" + matname + ".png"
render outputwidth:RenderWidth outputheight:RenderHeight outputFile:sortie vfb:myCheckBox.checked


messageBox "RENDER OK"