Ok, Kerry ... just being the devils advocate for a minute.. what happens when he has edited like a thousand drawings....the acad.cfg gets HUGE, plus the drawing cannot be edited across machines effectively...
If you don't like USERxx variables that is ok.. I was simply trying to offer the simplest solution to the problem..
But...
We can still have an internal count (internal to the drawing) that is editable by the program across multiple edits and on different machines at the same time...
(defun CNT ()
(vl-load-com) ; per the Daron Act
(if #CNT
nil
(if (not(setq #CNT (vlax-ldata-get "DuctCount" "CNT")))
(setq #CNT 0)
)
)
(setq #CNT (1+ #CNT))
(vlax-ldata-put "DuctCount" "CNT" #CNT)
(princ)
)
Now how is that.....totally portable, usable on R2000+, no external files and simple.