Jump to content

Changing the Default Directory for AutoCAD "Open" command?


muck

Recommended Posts

Hi

 

For AutoCAD 2007 the initial directory is stored in the registry

 

I am not sure if it still applies for 2010 but

 

To read the open dialog directory

 

(defun getDialog_OpenSavePath ()
 (vl-registry-read
   (strcat "HKEY_CURRENT_USER\\"
    (vlax-product-key)
    "\\Profiles\\"
    (getvar 'cprofile)
    "\\Dialogs\\OpenSaveAnavDialogs\\"
    )
 "InitialDirectory"
 )
)

 

To write to it

 

(defun setDialog_OpenSavePat (<file> / reg-key dialogPath   )
 (if
   (vl-file-directory-p (setq dialogPath  (vl-filename-directory <file>)))
   (progn
     (setq reg-key (strcat "HKEY_CURRENT_USER\\"
		    (vlax-product-key)
		    "\\Profiles\\"
		    (getvar 'cprofile)
		    "\\Dialogs\\OpenSaveAnavDialogs\\"))
     (vl-registry-write reg-key "InitialDirectory"  dialogPath))
   )
 )

 

 

 

(getDialog_OpenSavePath)
(setDialog_OpenSavePat (getvar 'dwgprefix))

 

Just be careful when reading/writing to registry as it is possible to corrupt parts of your computer

Link to comment
Share on other sites

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