Maxscript to connect lots of maps to 'CoronaMultiMap' node

So in the Slate material editor, I have a whole bunch of CoronaBitmap nodes that have loopable names (for example: ‘mask_1001’, ‘mask_1002’, etc.) all with textures and settings I want.

Does anyone know how to use maxscript to wire existing nodes in the SME to a ‘CoronaMultiMap’ node? I’ve been racking my brain, and I can’t figure it out myself…

Btw, I know how to add new CoronaBitmap nodes to the CoronaMultiMap, but not existing nodes.

-- max 2014 and above
fn getSMEselectedMtls = (

		viewNode = sme.GetView (sme.activeView)
		smeSelMats = #()
		for n = 1 to trackViewNodes[#sme][(sme.activeView)].numSubs do (
		m = trackViewNodes[#sme][sme.activeView][n].reference
		b = viewNode.GetNodeByRef m
		if b.selected do append smeSelMats m		
		)
		smeSelMats

)

fn connectMapsToCoronaMM = (

	maps = for m in getSMEselectedMtls() where superclassof m == textureMap collect m

	if maps.count == 0 or maps == undefined do (
		format "No maps selected"
		return false 
	)

	coronaMM = for m in maps where classof m == CoronaMultiMap collect m
	if coronaMM.count > 0 then coronaMM = coronaMM[1] else (
		format "CoronaMultiMap is not selected"
		return false 
	)

	for i=1 to maps.count where maps[i] != coronaMM do (

		coronaMM.texmaps[i-1] = maps[i]	

	)


)

connectMapsToCoronaMM()

select all the map nodes you wish to connect and target coronaMultiMap node then run script

Thank you very much!!