marting 发表于 2017-4-8 14:54:38

获得一个随机的临时文件名


(defun tempname        (ext / DrvObj FilSys RetVal)
(if
    (setq FilSys (vlax-create-object "Scripting.FileSystemObject"))
   (progn
       (if (setq tmp (vlax-invoke filsys 'gettempname))
       (setq tmp (strcat (substr tmp 1 (- (strlen tmp) 4))ext))
       )
       (vlax-release-object FilSys)
   )
)
tmp
)


命令: (tempname ".dwg")
"radE6540.dwg"

命令: (tempname ".txt")
"radEC1BB.txt"

命令: (tempname "")
"rad8BF6F"

sicky111 发表于 2017-4-9 00:03:24

啥也不说了,感谢楼主分享哇!

tigcat 发表于 2026-1-14 21:11:38

谢谢马丁大侠分享。
页: [1]
查看完整版本: 获得一个随机的临时文件名