Replacing autodesk_map to bitmaptexture

Hi I have a problem of replacing Autodesk map with bitmap texture that already inside some object.
I would be realy greatfull if someone could help me to solve this problem since i have so many materials i have to change. So far ive got...

for mp in scenematerials do
(if isProperty mp "Generic_Image" AND classof mp.Generic_Image == Autodesk_Map then
a = mp.generic_image.Parameters_Source as string
grt = trimleft a "BitMap:"
nwmp = Bitmaptexture ()
nwmp.name = mp.Generic_image.name
nwmp.filename = grt
nwmp.coords.realWorldScale = on
nwmp.coords.U_Offset = 0
nwmp.coords.V_Offset = 0
nwmp.coords.U_Tiling = mp.generic_image.Scale_Width
nwmp.coords.V_Tiling = mp.generic_image.Scale_Height
nwmp.coordinates.UVW_Type= 0
nwmp.coordinates.U_Mirror = false
nwmp.coordinates.V_Mirror = false
nwmp.coordinates.U_Tile = true
nwmp.coordinates.V_Tile = true
nwmp.output.output_amount = (mp.generic_image.Parameters_Brightness * 0.01)
nwmp.output.invert = mp.generic_image.Parameters_Invert_Image
nwmp.coords.W_angle = mp.generic_image.Position_Rotation
nwmp.coords.blur = mp.generic_image.Advanced_Parameters_Blur
nwmp.coords.blur_Offset = mp.generic_image.Advanced_Parameters_Blur_Offset
nwmp.filtering = mp.generic_image.Advanced_Parameters_Filtering
nwmp.coordinates.mapChannel = mp.generic_image.Advanced_Parameters_Map_Channel
replaceInstances nwmp mp???)