Based on Emmanuel Jordan's mgraphics-connector example.
This creates midiin and midiout objects for each port on startup.
The output from the JSUI scripts connections between midiin and midiout objects.
The use case that inspired this is the need to share a USB class-compliant device among several applications on Windows. The built-in drivers on Windows only allow one application to use one device. It's annoying. Max erases this annoyance. You'll of course need a MIDI loopback driver on your Windows machine (equivalent to Mac's IAC driver) to make use of this. MIDI Yoke http://www.midiox.com
is one such driver.
The js is only slightly modified from EJ's example. I added a "delete connection on doubleclick" function and made the rounded corners have a radius of 2. Rounded corners are SOOOOO Max 5 :)