Recent File Path
I can't find a list of Setvars in help anymore, but does anyone know if there is one to return "Recent Path" to a specific directory on starting a new session as I seem to remember it used to?The Open File dialogue is sometimes helpful when it opens in the last directory visited, but more often one has to dig their way out before digging in to the directory one wants.The behaviour has varied through versions which is not surprising since there is no ideal, but the one in the current V9 is not as ideal as it has been at times in the past. If I could remember the very original behaviour in I98, I believe that was as good as any since.
Comments
-
John,I think you want the REMEMBERFOLDERS variable set to 0 to use the start in folder.
0 -
I've been wanting to have an easy way to control where the open and save dialogs point and this question brought it to the front so here is a function to help me, hope it helps someone else...
;; Set the path for file open and save dialogs. Validation of the path;; input existence is not done here.(defun set_dwg_open_save_path ( path / app pkey recent_paths_key_name) (if (and path (/= path "")) (progn ;; get the application object (setq app (vlax-get-acad-object)) ;; get the registry product key (setq pkey (vlax-product-key)) ;; create the string path to the "Recent Paths" key ;; in the current profile (setq recent_paths_key_name (strcat "HKEY_CURRENT_USER\\" pkey "\\Profiles\\" (getvar "CPROFILE") "\\Recent Paths\\")) ;; set the Dwg path in Recent Paths to see if it is used ;; for the Open dialog (vl-registry-write recent_paths_key_name "Dwg" path) ) ))(defun C:TEST ( / ) (set_dwg_open_save_path "C:\\CAD"))(prin1)
0 -
Not very well formatted in the posting though...
0 -
Thanks Greg I will try those.
0 -
the lisp code written the appropriate path in "profiles/Recent Paths/Dwg" in the registry data,
but bricscad won't open with this registry data
it's a bug of the V13 ?0 -
@Mathieu,
The code works. Potentially issue with format from pasting to the forum. Repost of code below, and attach just in case. Note this code is sets the folder used when _REMEMBERFOLDERS is ON. However the effects are rather subtle. It only works the first time you open or save a drawing, after that it will use the folder were the drawing is located instead. So this code will only work at startup prior to opening or saving any drawing. This is code is from an old post, so maybe it was a work around for that particular BricsCAD version.
Note I've tweaked the code a little to check whether the folder exist prior to setting.
[code];; Set the path for file open and save dialogs. Validation of the path
;; input existence is not done here.
(defun set_dwg_open_save_path ( path / app pkey recent_paths_key_name)
(if (findfile path)
(progn
;; get the application object
;;(setq app (vlax-get-acad-object)) ;;not used
;; get the registry product key
(setq pkey (vlax-product-key))
;; create the string path to the "Recent Paths" key
;; in the current profile
(setq recent_paths_key_name
(strcat
"HKEY_CURRENT_USER\\"
pkey
"\\Profiles\\"
(getvar "CPROFILE")
"\\Recent Paths\\"
)
)
;; set the Dwg path in Recent Paths to see if it is used
;; for the Open dialog
(vl-registry-write recent_paths_key_name "Dwg" path)
path ; return path to flag success
)
nil ; return nil to flag failure (invalid path)
)
)
(defun C:TEST ( / )
(set_dwg_open_save_path "C:\\")
)
(defun C:TEST1 ( / )
(set_dwg_open_save_path "C:\\Nonexistant path")
)
(prin1)[/code]
You can achieve the same by setting _REMEMBERFOLDERS off, and then customising the start-in section of the shortcut you use to start BricsCAD with. BricsCAD will then initially use that folder when opening and saving. If you launch BricsCAD from Windows Explorer by double clicking on a drawing, then that will be your start-in folder instead. See attached screen grab. Doing this is safer than mucking around with the registry.
Another approach is to customise the Places Bar of the File Dialogue. You can do this via ._SETTINGS, attach another screen grab to illustrate.
Regards,Jason Bourhill
dlgSettings-PlacesBar-Customise.pngBricscadShortcut-Customise.png0