|
(vl-load-com)
(defun K:SearchAndLoadFunc (FuncPath / FuncTypes Error i FileNamLst FileNam FilePath xx)
;(setq FuncPath "C:\\FuncPath");搜索程序的目录
(setq FuncTypes '("*.LSP" "*.FAS" "*.VLX"));搜索源程序的类型
(setvar "SECURELOAD" 0);从所有位置加载文件(信任不警告)
(setq Error Nil);清空变量,避免串门
(repeat (setq i (length FuncTypes))
(if (setq FileNamLst (vl-directory-files FuncPath (nth (setq i (1- i)) FuncTypes) 1))
(mapcar
'(lambda (FileNam / FilePath)
(setq FilePath (strcat FuncPath "\\" FileNam))
(if (vl-catch-all-error-p (vl-catch-all-apply 'load (list FilePath)));捕捉到了错误
(setq Error (cons FilePath Error))
)
)
FileNamLst
)
)
);加载程序并搜集错误
(if Error ;如果有发生错误
(progn
(princ "\n——★★★ 以下文件未加载成功,请检查! ★★★——")
(foreach xx Error (princ (strcat "\n--> " xx)))
)
)
(princ)
) |
|