文件另存lisp,求帮助能判断一下时间格式,只保留最新的时间,免得文件重命名越来越长,谢谢
- ;;直接按时间更改名字另保并打开目录
- (defun c:sav ( / date dwgtitled newname oldname path)
- (if (= (getvar "DWGTITLED") 0)
- (ALERT "请先保存文件!")
- (progn
- (setq path (getvar "DWGPREFIX")
- oldname (vl-filename-base (getvar "DWGNAME"))
- )
- (setq date (menucmd "M=$(edtime,$(getvar,date),[YYYY-MO-DD]-[HH-MM-SS])"))
- (setq newname (strcat path oldname date))
- (command "_.save" newname)
- (princ (strcat "\n---本图已另存为" newname ".dwg"))
- )
- )
- (initget "Q")
- (setq key (getkword "\n本图已另存是否打开另存文件夹 [打开(Q)/ <不打开(默认)>"))
- (if (= key "Q")
- (startapp (strcat "explorer /select, " (getvar "dwgprefix") (getvar "dwgname") ", /e"))
- )
- (princ)
- )
|