试试这个:
- (defun txttonotepad ( txtlist / txtfile LFDES ) ;;creates list of LISPs to notepad
- (if (strcat (getvar "TEMPPREFIX") "txtlist.txt")(vl-file-delete (strcat (getvar "TEMPPREFIX") "txtlist.txt"))) ;;delete existing file
- (setq txtfile (strcat (getvar "TEMPPREFIX") "txtlist.txt")) ;;create new temp file
- (setq LFDES (open txtfile "w"))
- (foreach x txtlist
- (write-line x LFDES)
- )
- (setq LFDES (close LFDES))
- (if (findfile txtfile) (startapp "notepad" txtfile))
- (if (not (findfile txtfile)) (princ "\nError writing file"))
- (princ)
- )
发送到这里的文本是一个列表,每个列表项都是一个新行:
例如:
- (txttonotepad (list "Item 1" "Item 2" "Item 3"))
如果您修改代码以从命令行中显示的内容创建列表,它应该可以工作。
|