Unless there's been a fairly dramatic change to the scripting API then it's not possible. You have no useful access to the layer stack or tools via script
try this script: http://www.scriptspot.com/3ds-max/scripts/detriangulator hoefully it will clean your mesh to the extent that you can select the edgeloop
Drop On script which is part of miauu's Script Pack vol.2 allows spline projection(whole spline or part of it) on surface with an option to project the tangents of the knots.