- ;;文件备份 By Gu_xl 2013.05.19
- (defun c:tt1 (/ PATH NAME TIME) (vl-load-com)
- (setq path (getvar 'dwgprefix)
- name (getvar 'dwgname)
- time (rtos (getvar 'cdate) 2 4)
- time (vl-string-subst "-" "." time)
- )
- (if (not (findfile (strcat path "备份目录")))
- (progn
- (gxl-file-CreateFolder (strcat path "备份目录") 0)
- )
- )
- (command "save" (strcat path "备份目录\\" (VL-FILENAME-BASE name) "-" time ".dwg"))
- (Explore (strcat path "备份目录\\" )
- )
- )
- (defun gxl-file-CreateFolder (FNAME att / SYS FOLDER)
- (if (not (findfile FNAME))
- (progn
- (setq SYS (vlax-create-object "Scripting.FileSystemObject"))
- (setq FOLDER (VL-CATCH-ALL-APPLY
- 'vlax-invoke-method
- (list SYS 'CREATEFOLDER FNAME)
- )
- )
- (if (not (VL-CATCH-ALL-ERROR-P FOLDER))
- (progn
- (vlax-put FOLDER
- "Attributes"
- att
- )
- (vlax-release-object FOLDER)
- )
- )
- (vlax-release-object SYS)
- )
- )
- )
- ;;;(Explore 路径) 浏览文件夹
- ;;;(Explore "c:\\") (Explore 5)
- (defun Explore ( target / Shell result ) (vl-load-com)
- ;; ?Lee Mac 2010
- (setq Shell (vla-getInterfaceObject (vlax-get-acad-object) "Shell.Application"))
- (setq result
- (and (or (eq 'INT (type target)) (vl-file-directory-p target))
- (not
- (vl-catch-all-error-p
- (vl-catch-all-apply 'vlax-invoke (list Shell 'Explore target))
- )
- )
- )
- )
- (vlax-release-object Shell)
- result
- )
|