Jump to content

Changing Files Tab (Options Dialog Box) via command line?


jamesfear

Recommended Posts

I've been giving myself a headace trying to figure out if there is a way to rename the Tool Palettes File Location with a Lisp or a Macro;

 

from;

C:\Documents and Settings\____\Application Data\Autodesk\AutoCAD 2008\R17.1\enu\Support\ToolPalette

 

to;

C:\Documents and Settings\____\Application Data\Autodesk\AutoCAD 2008\R17.1\enu\Support\ToolPalette02

 

 

I know I can manually change it by simply renaming it (double left click or F2) but I need to do it once a week on twenty computers every week.

Link to comment
Share on other sites

You can use this:

 

(setvar "*_TOOLPALETTEPATH"
       (strcat "C:\\Documents and Settings\\"
               UserName
               "\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette02"))

 

Just change the UserName with whatever you need.

 

Regards,

Mircea

Edited by MSasu
formatted code
Link to comment
Share on other sites

Jamesfear,

 

This command (invoked by tp02 at the command line) will identify the current OS running, grab the user's login name and construct the path dependent on the os version, to be set to the system variable, *_toolpalettepath. The program then checks to see if the directory exists and if it does then sets the variable, otherwise tells you it doesn't exist.

(defun c:tp02 (/)
 (vl-load-com)
 (setq	windows
 (strcase
   (vl-registry-read
     "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
     "ProductName"
   )
 )
 )
 (setq loginname (getvar 'loginname))
 (cond
   ((wcmatch windows "*XP*")
     (progn
(setq path (strcat "C:\\Documents and Settings\\"
		   loginname
		   "\\Application Data\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette"
	   )
)
     )
   )
   ((or (wcmatch windows "*VISTA*") (wcmatch windows "*7*"))
     (progn
(setq path (strcat "C:\\Users\\"
		   loginname
		   "\\AppData\\Roaming\\Autodesk\\AutoCAD 2008\\R17.1\\enu\\Support\\ToolPalette"
	   )
)
     )
   )
   (T (princ "\nThis version of the Operating System is not compatible with your path selections!")))
 (if (vl-file-directory-p path)
   (setvar '*_toolpalettepath (strcat path "02"))
   (princ "\nLocation of toolpalette directory does not exist:"))
 (princ))

 

Otherwise to shed light on the rest of the files tab:

Here is an explanation:

(vl-load-com) ;It is good practice to have this in your code when you are using vl, vla, vlr or vlax functions
(setq Options_dialog (vla-get-preferences		;the vla function that grabs preferences (options) from
	       (vlax-get-acad-object)))		;the Acad object (your open & active autocad session)
(setq files (vla-get-files Options_dialog))		;this will grab the "files tab" of the prefernces object
(vlax-dump-object files T)				;by "dumping" the object you get all of the possible interactions
;you can use "(vla-get-********" much like getvar
;and you can use "vla-put-*******" much like setvar
;if you have no idea what setvar and getvar are you need to learn every system variable that Cad has to offer.

 

hope that helps, hint: when working with visual lisp just dump everything to get the hang of it.

 

Kind Regards,

 

Matt

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