Aligning Uv parts

Hey Guys,
Ive been struckling with this long enough, and I dont think this should be so hard but I cant get it to work.

Basically ive got a planar unwrap script, but I want all the bottom edge of every seperate UV-part to be aligned on the x-Axis in the UV editor. Please look at the attachment to see what exactly I'm looking for.

Ive tried various things but it either explodes the parts all over the editor or scales the uv-part flat on the x-Axis...

I hope someone can help me out here...

1.jpg462.6 KB