本帖最后由 cq4920 于 2022-12-1 00:01 编辑
监控命令窗口,出现QSAVE触发命令!
问题1,目前只能保存两次记录(已解决)
问题2,相同文件地址和名称,不能覆盖(需要一个查重--已解决)
问题3,如何提取记录,然后快速打开文件!(已解决)
- (vlr-command-reactor nil '((:VLR-commandEnded . cmdEnd)))
- (defun cmdend (vlr lst)
- (setq cmd (car lst))
- (if (= cmd "QSAVE")
- (dwgs)
- )
- )
- (defun dwgs (/ dwgname dwgfile fp dwgfile path file i a out )
- (setq dwgname (getvar 'dwgname))
- (setq dwgfile (getvar "DWGPREFIX"))
- (setq dwgfilename (strcat dwgfile dwgname))
- (SETQ FP (OPEN "C:\\Users\\Administrator\\AppData\\Roaming\\MRCSET.TXT" "r"))
- (SETQ path (READ-LINE FP))
- (CLOSE FP)
- (setq pathn (strcat path "\\配置\\history" ".txt"))
-
- (if (vl-directory-files (strcat path "\\配置\") "history.txt")
- (progn
- (setq file (open pathn "r"))
- (while (setq a (read-line file))
- (setq out (append out (list a)))
- )
- (close file)
- (setq out (append (list dwgfilename) out)
- i 0)
- (setq out (MC-pt out)) ;;查重
- (setq file (open pathn "w"))
- (repeat (length out)
- (write-line (nth i out) file)
- (setq i (1+ i))
- )
- (close file)
- )
- (progn
- (setq file (open pathn "w"))
- (write-line dwgfilename file)
- (close file)
- ))
-
- )
|