明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 546|回复: 5

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

[复制链接]
发表于 2021-9-12 22:32 | 显示全部楼层 |阅读模式
(setq fmodify (vl-file-systime (strcat(getvar "DWGPREFIX")(getvar "DWGNAME"))))
(if (= fmodify nil)(Princ "■文件修改未知■")
(princ fmodify)
)

发表于 2021-9-12 22:59 | 显示全部楼层
;;圖檔被打開狀態下..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)
)
 楼主| 发表于 2021-9-14 22:38 | 显示全部楼层
shenhung 发表于 2021-9-12 22:59
;;圖檔被打開狀態下..FILE-SYSTIME 會回傳NIL
(defun DwgForm_file_date (strFile / lstDate)
  (if (vl- ...

可以给一个defun c:的可以执行的么,把日期的princ出来就好
发表于 2021-9-15 18:04 | 显示全部楼层
读取当前dwg文档上一次的修改时间
http://bbs.mjtd.com/thread-184136-1-1.html
 楼主| 发表于 2021-9-15 21:10 | 显示全部楼层
tryhi 发表于 2021-9-15 18:04
读取当前dwg文档上一次的修改时间
http://bbs.mjtd.com/thread-184136-1-1.html

发表于 2022-8-22 23:39 | 显示全部楼层
本帖最后由 消失的天空 于 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)))
  )

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?注册

x
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-4-20 02:49 , Processed in 0.189212 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表