Aftertouch Posted March 27, 2019 Posted March 27, 2019 (edited) Hello all, Is it possible to change the default path of the 'SaveAs' location by lisp? I already found out that the variable 'REMEMBERFOLDERS' triggers something, but thats not what im looking for. I want to change the default path of the 'last used folder' by lisp... In the REGISTER i found this option for the XATTACH (vl-registry-write (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (vla-get-activeprofile (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))) "\\Dialogs\\BrowseropenDialog") "InitialDirectory" (getvar "dwgprefix")) But where is the 'SaveAs' / last used path stored..... Edited March 27, 2019 by Aftertouch Quote
ronjonp Posted March 27, 2019 Posted March 27, 2019 (edited) You might be able to pick something out of THIS. This code saves me tons of time browsing the network. Just looked at what I'm using now and this is it: (defun rjp-currentpath (/ dp hkcu key) ;; RJP » 2019-03-27 ;; Sets current drawing directory for XREF, ETRANSMIT, SHEETSET and PUBLISH commands ;; Writes to registry so use at your own risk... (cond ((= (getvar 'dwgtitled) 1) (setq dp (getvar 'dwgprefix) hkcu (strcat "HKEY_CURRENT_USER\\" (cond ((vlax-user-product-key)) ((vlax-product-key)) ) ) key (strcat hkcu "\\Profiles\\" (getvar 'cprofile) "\\Dialogs\\") ) (vl-registry-write (strcat hkcu "\\ETransmit\\Setups\\Standard\\") "Destfolder" dp) (cond ((wcmatch (getenv "username") "*") (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6" dp) (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6Display" "Current Directory" ) (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6Ext" "") ) ) (vl-registry-write (strcat hkcu "\\ETransmit\\Setups\\Standard\\") "Destfolder" dp) (foreach reg '(("acad-131" "InitialDirectory") ("AcPublishDlg" "Location") ("AcSmNav:OpenSheetSet" "InitialDirectory") ("BrowseFolder" "InitialDirectory") ("BrowseforPlotFilePlotDlg" "InitialDirectory") ("BrowseropenDialog" "InitialDirectory") ("CreateTransmittalDialog" "DefaultPath") ("DSDNavDlg" "InitialDirectory") ("DWFNavDlg" "InitialDirectory") ("OUTPUTFOLDERDLG" "InitialDirectory") ("OpenSaveAnavDialogs" "InitialDirectory") ("PDFopenDialog" "InitialDirectory") ("SSMNavigator" "OpenSheetSetPath") ("SSMNavigator" "ImportLayoutsAsSheetsPath") ("Save Drawing As" "InitialDirectory") ("Select File" "InitialDirectory") ("Select a drawing to compare" "InitialDirectory") ;; RJP » 2022-01-05 -XREF dialog key ("Select Reference File" "InitialDirectory") ("Enter name of file to overlay" "InitialDirectory") ("Sheet Set Wizard" "BrowseForLayoutsPath") ("Sheet Set Wizard" "SheetSetCreatePath") ("XattachFileDialog" "InitialDirectory") ) (vl-registry-write (strcat key (car reg)) (cadr reg) dp) ) ) ) (princ) ) (or *current-path-reactor* (setq *current-path-reactor* (vlr-command-reactor nil '((:vlr-commandwillstart . startcommand)))) ) (defun startcommand (calling-reactor startcommandinfo) (and (wcmatch (car startcommandinfo) "*XREF,XATTACH,ETRANSMIT,*SHEET*,PUBLISH,*SAVEAS*,OPEN") (rjp-currentpath) ) ) Edited January 7, 2022 by ronjonp *Added current code 1 Quote
BIGAL Posted March 28, 2019 Posted March 28, 2019 You can "REDEFINE" a command so you could do your own "saveas" that is a lisp pointing to the correct folder location. You use UNdefine to reset it back. Quote
Aftertouch Posted March 28, 2019 Author Posted March 28, 2019 @ronjonp Thanks for the code, this is exactly what im looking for! (Have to run some tests tho, but look like this is it. Quote
ronjonp Posted March 28, 2019 Posted March 28, 2019 5 hours ago, Aftertouch said: @ronjonp Thanks for the code, this is exactly what im looking for! (Have to run some tests tho, but look like this is it. Glad to help Quote
Aftertouch Posted March 29, 2019 Author Posted March 29, 2019 @ronjonp I tested the code and modded it a bit for my needs. But sure helped me alot! One thing my colleges gave back to me: When you 'open' or 'save-as' the default 'DESKTOP' icon was missing in the menu, so i added these lines: (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6" "Desktop") (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6Display" "Desktop") (vl-registry-write (strcat key "AllAnavDialogs\\") "PlacesOrder6Ext" "") Wich are the default lines for 'PlacesOrder5'. This returned the default desktop icon again. Quote
robert06 Posted January 5, 2022 Posted January 5, 2022 (edited) Thank you @ronjonp for "rjp-currentpath" It affects XREF & XATTATACH commands, but what registry key should be modified to make this work also with -XREF command, which i'm using through a lisp. Edited January 5, 2022 by robert06 Quote
ronjonp Posted January 5, 2022 Posted January 5, 2022 (edited) 5 hours ago, robert06 said: Thank you @ronjonp for "rjp-currentpath" It affects XREF & XATTATACH commands, but what registry key should be modified to make this work also with -XREF command, which i'm using through a lisp. I'll have to dig into it not sure as of now. Figured it out Edited January 5, 2022 by ronjonp *updated code above to work with -xref command Quote
robert06 Posted January 6, 2022 Posted January 6, 2022 Hi, thank you. But in acad 2022 this still does not work for -XREF. Quote
ronjonp Posted January 6, 2022 Posted January 6, 2022 8 hours ago, robert06 said: Hi, thank you. But in acad 2022 this still does not work for -XREF. Strange ... I'm on 2022 and it works fine . Quote
tombu Posted January 6, 2022 Posted January 6, 2022 On 3/27/2019 at 11:57 AM, ronjonp said: You might be able to pick something out of THIS. This code saves me tons of time browsing the network. Just looked at what I'm using now and this is it: I've been using your 9/16/2013 version here. Updating to your current version now. Thanks again! Quote
ronjonp Posted January 6, 2022 Posted January 6, 2022 17 minutes ago, tombu said: I've been using your 9/16/2013 version here. Updating to your current version now. Thanks again! You're welcome! Quote
robert06 Posted January 7, 2022 Posted January 7, 2022 18 hours ago, ronjonp said: Strange ... I'm on 2022 and it works fine . It works with -Xref / attach, but not with -xref / overlay. Quote
ronjonp Posted January 7, 2022 Posted January 7, 2022 (edited) 9 hours ago, robert06 said: It works with -Xref / attach, but not with -xref / overlay. Yup .. just tested here. I'll see if I can find that key as well. Edited January 7, 2022 by ronjonp 2 Quote
robert06 Posted January 7, 2022 Posted January 7, 2022 (edited) While dealing with this already, it would be great, if publishing (printing) to pdf from autocad (DWG to PDF.pc3, Autocad PDF.pc3 etc) keys would be featured as well. Thank you! Edited January 7, 2022 by robert06 Quote
ronjonp Posted January 7, 2022 Posted January 7, 2022 Updated code above: ("Enter name of file to overlay" "InitialDirectory") 2 Quote
ronjonp Posted January 7, 2022 Posted January 7, 2022 2 hours ago, robert06 said: While dealing with this already, it would be great, if publishing (printing) to pdf from autocad (DWG to PDF.pc3, Autocad PDF.pc3 etc) keys would be featured as well. Thank you! If you use publish it should set the default path: ("AcPublishDlg" "Location") Quote
robert06 Posted January 7, 2022 Posted January 7, 2022 2 hours ago, ronjonp said: Updated code above: ("Enter name of file to overlay" "InitialDirectory") Thank you once again! Quote
ronjonp Posted January 7, 2022 Posted January 7, 2022 Just now, robert06 said: Thank you once again! Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.