In the absence of a better solution, please accept this one which I propose. Any comments are welcome.
;;Read shape names defined inside a SHX file
;;lido 22.01.2121
(defun shpnames (SHX_file / $line EXE_file INN_file OPN_file OUT_file SHP_list TMP_file)
(cond
( (not (setq INN_file (findfile SHX_file))) (alert (strcat SHX_file " file not found.")))
( (not (setq EXE_file (findfile "dumpshx.exe"))) (alert "dumpshx.exe file not found."))
( T
(setq OUT_file (vl-filename-mktemp (strcat (vl-filename-base SHX_file) ".SHP")))
(if (> (startapp (strcat EXE_file " -o " OUT_file " " INN_file)) 2)
(progn
(while (< (vl-file-size OUT_file) 1)) ;;Delay, do not delete!
(setq OPN_file (open OUT_file "r"))
(while (setq $line (read-line OPN_file))
(if (= (substr $line 1 1) "*")
(setq SHP_list (cons (substr $line (- (strlen $line) (vl-position 44 (reverse (vl-string->list $line))) -1)) SHP_list))
)
)
(close OPN_file)
(if (setq TMP_file (findfile (strcat (vl-filename-directory OUT_file) "\\" (vl-filename-base OUT_file) ".TMP"))) (vl-file-delete TMP_file)) ;;Dumpshx.exe Version 1.3 make this file
(while (findfile OUT_file) (vl-file-delete OUT_file)) ;;An other delay, do not delete!
)
)
)
)
(vl-sort SHP_list (function (lambda (a b) (< a b))))
) ;;shpnames
(vl-load-com)