I know very little of coding, and I'm trying to hack my way through a script that merges a file (this part has been easy), selects a bone in the file (also easy), and lets me click in the viewport and place it (again, pretty easy).

What I need next is something that doesn't seem trivial; I'd like a piece of code that rotates the selected object to point toward the mouse until I click. I just want to be able to quickly drop in this object and rotate it graphically.

Code:
print "Click to Place the starting point of the Jetway"
mergeMaxFile ("otherJetway.max") #autoRenameDups #useMergedMtlDups
select $B1C1
pnt = point3 0 0 0
pnt = pickPoint snap: #2D rubberband: pnt
$.pos = pnt 
$.name = "PLACEDROOTBONE"
I'm sure my coding is ugly, but is there a way to have some kind of live function that keeps spinning the current selection to face the mouse until I click somewhere in the viewport?