Jump to content

Recommended Posts

Posted (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 by Aftertouch
Posted (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 by ronjonp
*Added current code
  • Like 1
Posted

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.

Posted

@ronjonp

Thanks for the code, this is exactly what im looking for! (Have to run some tests tho, but look like this is it.

 

Posted
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 :)

Posted

@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.

 

  • 2 years later...
Posted (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 by robert06
Posted (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 by ronjonp
*updated code above to work with -xref command
Posted

Hi, thank you. But in acad 2022 this still does not work for -XREF.

Posted
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 🤔.

Posted
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!

Posted
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! 🍻

Posted
18 hours ago, ronjonp said:

Strange ... I'm on 2022 and it works fine 🤔.

It works with -Xref / attach, but not with -xref / overlay.

Posted (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 by ronjonp
  • Like 2
Posted (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 by robert06
Posted

Updated code above: 

("Enter name of file to overlay" "InitialDirectory")

 

  • Like 2
Posted
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")

Posted
2 hours ago, ronjonp said:

Updated code above: 

("Enter name of file to overlay" "InitialDirectory")

 

Thank you once again!

Posted
Just now, robert06 said:

Thank you once again!

🍻

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...