I had this from Lee, but usually always go way counter-clockwise and only select the polyline, not the point.
;; Polyline Vertex Exporter ~ by Lee McDonnell ~ 26.11.2009
(defun c:pExp2 (/ ss tmp i j ent tot dis pt)
(vl-load-com)
(if (and (setq ss (ssget '((0 . "*POLYLINE"))))
(setq tmp (getf...