Export UVW channel 2 (max2010)

Hi all,

can someone tell me how I can export my UVW map channel 2 to a file by using a script (withouth having to enter the filename manually)?

I have written a small script, but it just opens the UVW export window and I have to enter the names manually. Unfortunately the "$.modifiers[#unwrap_uvw].unwrap.save ()" command does not accept a filname as input.

outPath = "c:\\temp"
selection_array = selection as array
for i = 1 to selection_array.count by 1 do  
    current_obj = selection_array[i]    
    objName = current_obj.Name
    -- set the filename to the object filename
    exportname = outPath + "\\" + objName + ".obj"
    select current_obj 
    -- save uvw map 2
    exportname_uvw2 = outPath + "\\" + objName + "-uv2.uvw"
    $.modifiers[#unwrap_uvw].unwrap.save () --exportname_uvw2