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