Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Profile selection lisp

2 REPLIES 2
Reply
Message 1 of 3
SirLevAris
193 Views, 2 Replies

Profile selection lisp

Does anyone know how I could get autocad to look for a profile based on the user's login name and load that profile? This would make it easier for poeple to use other's machines when they are not there and not mess up the original settings.
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: SirLevAris

;; Function to set a profile active by its input name
;; Returns:
;; Profile Name - if it's already active
;; nil - if either the name is not a string or it is not found.
;; T - if the Name is found and different from the active profile.
;;
;; Name is NOT case-sensitive
;;
(defun set_acad_profile (Name / AcApp AcPrefs AcProfiles Active)
(vl-load-com)
(if (and (= (type Name) 'STR)
(setq AcApp (vlax-get-acad-object))
(setq AcPrefs (vlax-get AcApp "Preferences"))
(setq AcProfiles (vlax-get AcPrefs "Profiles"))
(setq Active (vlax-get AcProfiles "ActiveProfile")))
(if (= (strcase Name)(strcase Active))
Active
(if (vl-catch-all-error-p
(vl-catch-all-apply 'vlax-put (list Acprofiles
"Activeprofile" Name))
)
(prompt (strcat "\nProfile \"" Name "\" not found."))
T
)
)
)
)

You could use it like...
(set_acad_profile (getvar "loginname"))

--
John Uhden, Cadlantic/formerly CADvantage
--> mailto:juhden@cadlantic.com
--> http://www.cadlantic.com
2 Village Road
Sea Girt, NJ 08750
Tel. 732-974-1711
FAX 732-528-1332

"SirLevAris" wrote in message
news:f089502.-1@WebX.maYIadrTaRb...
> Does anyone know how I could get autocad to look for a profile based on
the user's login name and load that profile? This would make it easier for
poeple to use other's machines when they are not there and not mess up the
original settings.
>
Message 3 of 3
Anonymous
in reply to: SirLevAris

I fairly certain that AutoCAD stores a new profile when another user logs
on. Hence the registry location...
'HKEY_CURRENT_USER\Software\Autodesk\AutoCAD\R15.0\ACAD-1:409\Profiles' is
storing profiles for a particular user ... not all users.

The 'Profiles' key is not found under HKEY_LOCAL_MACHINE.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost