Not sure if this snippet could do the trick ....
I guess it depends at what time the lisp is executed cause if you run it before it acknowledge what is missing you won't ever have no feedback from the lisp.
Here's the code :
(vl-load-com)
;; Function to log missing SHX details to a file
(defun LogMissingSHX (shxname / dwgname shxpath outfile)
(if shxname
(progn
;; Get drawing name
(setq dwgname (getvar "DWGNAME"))
;; Get expected SHX path (AutoCAD Fonts folder)
(setq shxpath (strcat (getvar "ACAD") "Fonts\\"))
;; Open file in append mode
(setq outfile (open "C:\\MissingSHX_Log.txt" "a"))
;; Write details to file
(if (and dwgname shxname outfile)
(progn
(write-line (strcat "Drawing: " dwgname) outfile)
(write-line (strcat "Missing SHX: " shxname) outfile)
(write-line (strcat "Expected Location: " shxpath) outfile)
(write-line "------------------------" outfile)
(princ (strcat "\nLogged missing SHX: " shxname " for drawing: " dwgname))
)
(princ "\nError: Could not gather all required information.")
)
;; Close the file
(if outfile (close outfile))
)
)
(princ)
)
;; Reactor callback to detect missing SHX files
(defun MissingSHXReactorCallback (reactor command-list / shxname)
;; Check if the command is related to drawing open or font loading
(if (member (car command-list) '("OPEN"))
(progn
;; Simplified detection: Check if FONTALT is triggered or prompt occurs
;; In practice, you may need to parse command-line prompts or use (tblobjname "STYLE" ...)
;; This is a placeholder; customize based on AutoCAD's behavior
(setq shxname (getvar "FONTALT"))
(if (and shxname (not (findfile (strcat shxpath shxname))))
(LogMissingSHX shxname)
)
)
)
(princ)
)
;; Set up the reactor
(if (not *MissingSHXReactor*)
(setq *MissingSHXReactor*
(vlr-command-reactor nil '((:vlr-commandWillStart . MissingSHXReactorCallback)))
)
)
(princ "\nMissing SHX Logger reactor loaded. Open a drawing to detect missing SHX files.")
(princ)
Frank Freitas
CAE/CAD/BIM Coordinator & Support Specialist