align or weld

Hi i attached the picture of what i want the script to do,
Simply i want to select all the inner borders of my poly or Mesh object which ever works, ( in my sample case there is 6 ) and have them connect, align or weld to each other just like it is the picture labeled After i tried putting a script together but it does not do it individually it connects all the borders to 1..

subobjectLevel = 3
$.EditablePoly.ConvertSelection #Border #Vertex
subobjectLevel = 1
$.EditablePoly.MakePlanarIn #X
$.weldThreshold = 0.01
$.EditablePoly.weldFlaggedVertices ()
subobjectLevel = 3

problem.jpg43.34 KB