Need help

what I need help to do, because I´m starting to 3dsmax scripting right now.
Well, I need to select a number of objects that it has your own paint effects modifier.
I need to aply If I have for exemple 10 boxes, 2 keys for paint vertex opacity channel
one wiht value 100 and the second with the value 0. And each box must to have as the following the Box1 frames 1 and 5, box2 frames 5 and 10 and ...
Could some one help me with That.
Thanks

iCount = 0
for o in $ do
(
iCount += 5
o.modifiers[#VertexPaint].layerOpacity = 100
addNewKey o.modifiers[#VertexPaint].layerOpacity.controller iCount #select
iCount += 5
o.modifiers[#VertexPaint].layerOpacity = 0
addNewKey o.modifiers[#VertexPaint].layerOpacity.controller iCount #select
)