I know the attempt to open in append mode is a bit scary, but it shouldn't do anything "wrong".
Anyhow, here's another method. It either returns nil if no-one has the drawing open, or it returns a list containing ("Username" "PC Name" "Date/Time") if someone has it open:(defun DWGOpenedBy (filename / dwl f lst s)
(if (and (setq dwl (findfile (strcat (vl-filename-directory filename) "\\" (vl-filename-base filename) ".DWL")))
(not (vl-file-delete dwl)))
(if (setq f (open dwl "r"))
(progn
(while (setq s (read-line f)) (setq lst (cons s lst)))
(close f)
(reverse lst)
)
T
)
)
)
Note though it only checks if someone's got it opened in AutoCAD. It would theoretically be possible to open a DWG in NotePad, though I can't imagine why you'd want to :ugly: