以下是群里大佬获取文件路径的对话框,能让选取时直接定位上次打开的路径吗?求大佬赐教!- (defun K:BrowPath (/ msg WinShell shFolder err path)
- (vl-load-com)
- (setq msg "请选择文件夹路径(默认为当前文件路径):")
- (setq winshell (vlax-create-object "Shell.Application"))
- (setq shFolder (vlax-invoke-method WinShell 'BrowseForFolder 0 msg 1))
- (setq err (vl-catch-all-apply
- '(lambda ()
- (setq shFolder (vlax-get-property shFolder 'self))
- (setq path (vl-string-right-trim "\"
- (vl-string-translate "/" "\"
- (vlax-get-property shFolder 'path)
- )
- )
- )
- )
- )
- )
- (if (vl-catch-all-error-p err)
- (getvar "dwgprefix");选择取消时,返回当前文件路径
- (strcat path "\");选择确定时,返回所选文件夹路径
- )
- )
|