iamhuangjinming 发表于 2021-9-12 22:32:51

想用vl-file-systime看文件上次保存的日期,可是总是返回nil怎么搞呢?

(setq fmodify (vl-file-systime (strcat(getvar "DWGPREFIX")(getvar "DWGNAME"))))
(if (= fmodify nil)(Princ "■文件修改未知■")
(princ fmodify)
)

shenhung 发表于 2021-9-12 22:59:26

;;圖檔被打開狀態下..FILE-SYSTIME 會回傳NIL
(defun DwgForm_file_date (strFile / lstDate)
(if (vl-file-systime strFile)
      (progn
      (setq a strfile)       
      (setq lstDate (mapcar 'DwgForm_check_digit (mapcar 'itoa (vl-file-systime strFile))))
                                    ; 年               月                  日                  時                  分
       (setq file-date (strcat (nth 0 lstDate) "-" (nth 1 lstDate) "-" (nth 3 lstDate) " " (nth 4 lstDate) ":" (nth 5 lstDate)))
      
      )
      (setq file-date "目前圖檔編輯中")
)
(if file-date file-date)
)

iamhuangjinming 发表于 2021-9-14 22:38:11

shenhung 发表于 2021-9-12 22:59
;;圖檔被打開狀態下..FILE-SYSTIME 會回傳NIL
(defun DwgForm_file_date (strFile / lstDate)
(if (vl- ...

可以给一个defun c:的可以执行的么,把日期的princ出来就好

tryhi 发表于 2021-9-15 18:04:24

读取当前dwg文档上一次的修改时间
http://bbs.mjtd.com/thread-184136-1-1.html

iamhuangjinming 发表于 2021-9-15 21:10:36

tryhi 发表于 2021-9-15 18:04
读取当前dwg文档上一次的修改时间
http://bbs.mjtd.com/thread-184136-1-1.html

消失的天空 发表于 2022-8-22 23:39:50

本帖最后由 消失的天空 于 2022-8-22 23:41 编辑

shenhung 发表于 2021-9-12 22:59
;;圖檔被打開狀態下..FILE-SYSTIME 會回傳NIL
(defun DwgForm_file_date (strFile / lstDate)
(if (vl- ...
可以在DCL上显示修改时间了。原版的跑不动,自己修改了一下用得起了
;;当被打开状态下..FILE-SYSTIME 返回NIL
(defun DwgForm_file_date (strFile / lstDate file-date)
(if (vl-file-systime strFile)
      (progn      
      (setq lstDate (mapcar 'itoa (vl-file-systime strFile))); 年-月-日-时-分
      (setq file-date (strcat "修改日期:"(nth 0 lstDate) "-" (nth 1 lstDate) "-" (nth 3 lstDate) " " (nth 4 lstDate) ":" (nth 5 lstDate))))
      (setq file-date "目前文件编辑中")
)
file-date
)
;;如果地址里面有杠杠换一下
;;地址转换"/" "\\"
(defun driss(string)
(while (vl-string-search "\\" string)
    (setq string (vl-string-subst "/" "\\" string)))
)
页: [1]
查看完整版本: 想用vl-file-systime看文件上次保存的日期,可是总是返回nil怎么搞呢?