;;;师兄 QQ361865648,简单的写了一个,测试的回显如下 ;;;命令: ;;;命令: test ;;;请输入要查找的字符,以短号隔开,可以使用通匹符: *str,545* ;;;命令: (defun c:test () (setq searchstr (getstring "\n请输入要查找的字符,以短号隔开,可以使用通匹符: " ) ) (SETQ STRLST (READ (STRCAT "(" (VL-LIST->STRING (subst 32 44 (VL-STRING->list searchstr))) ")" ) ) ) (setq strlst(mapcar 'VL-SYMBOL-name strlst)) (SETQ N 0 NEWLST NIL ) (REPEAT (LENGTH STRLST) (SETQ SS NIL J 0 ) (setq searchstr (nth n strlst)) (SETQ SS (SSGET "X" (LIST (CONS 0 "*TEXT") (cons -4 "<or") (CONS 1 (strcase searchstr)) (cons 1 (strcase searchstr t)) (cons -4 "or>") ) ) ) (SETQ N (1+ N)) (IF SS (SETQ J (SSLENGTH SS)) (SETQ J 0) )
(SETQ NEWLST (CONS J NEWLST)) ) (SETQ NEWLST (REVERSE NEWLST)) (setq f (open "c:/temp.txt" "w")) (mapcar '(lambda (x y) (WRITE-LINE (STRCAT x " 开头的 " (itoa y) " 个" ) F ) ) STRLST newlst ) (close f) ;;; (princ "\n已写入到临时文件 c:\\temp.txt") (startapp "notepad" "c:/temp.txt") (princ) )
|