View Full Version : Autoload Specific User Profile .lsp
bradlyferrell
2006-06-25, 05:17 AM
1) I am looking for a way (.lsp) to make a specific user profile load automatically from a network location when starting ADT 2006.
We have 15 users of ADT on our network, each with their own profile.arg
Any of those users should be able to 'login' to any workstation in the office and start ADT. The .lsp routine should recognize the user (by their Windows login) and automatically load that users profile that is stored on the network (all user profiles are kept in the same directory on our server).
Has anyone come across such a routine??
Would anyone be interested in writing such a routine??
2) I am also looking for a .lsp or macro that I can run to repath all the necessary links/options to our server location.
We are removing approx. 300MB worth of files from all C: drives on all workstations by repathing those workstations to the server [specifically the 'enu' folder(s)].
I am currently having to manually repath all machines/new machines. It would be great to have a routine that I could run to do all those changes for me.
Importing a profile.arg does not repath ALL necessary locations. It only changes about 50% of them.
Again,
Has anyone come across such a routine??
Would anyone be interested in writing such a routine??
I have read through most of the threads throughout the forums and have not found a suitable answer, yet.
Any help would be greatly appreciated.
Thanks,
Mike.Perry
2006-06-26, 12:30 PM
Hi
1. Have you browsed / seen the following...
change profile from command prompt?
Edit Project Files Search Path.
importing a profile with lisp
Changing User Profiles
Demand Load Profiles
2. What Paths are you referring to... What Paths do you want to update...
Have a good one, Mike
Doodlemusmaximus
2006-06-26, 01:23 PM
1) I am looking for a way (.lsp) to make a specific user profile load automatically from a network location when starting ADT 2006.
We have 15 users of ADT on our network, each with their own profile.arg
Any of those users should be able to 'login' to any workstation in the office and start ADT. The .lsp routine should recognize the user (by their Windows login) and automatically load that users profile that is stored on the network (all user profiles are kept in the same directory on our server).
Has anyone come across such a routine??
Would anyone be interested in writing such a routine??
2) I am also looking for a .lsp or macro that I can run to repath all the necessary links/options to our server location.
We are removing approx. 300MB worth of files from all C: drives on all workstations by repathing those workstations to the server [specifically the 'enu' folder(s)].
I am currently having to manually repath all machines/new machines. It would be great to have a routine that I could run to do all those changes for me.
Importing a profile.arg does not repath ALL necessary locations. It only changes about 50% of them.
Again,
Has anyone come across such a routine??
Would anyone be interested in writing such a routine??
I have read through most of the threads throughout the forums and have not found a suitable answer, yet.
Any help would be greatly appreciated.
Thanks,
Asking a question here do you load there desktop settings with each machine or do they move around to duifferent machines?
peter
2006-06-26, 02:19 PM
You mean like this?
Peter
; Written By: Peter Jamtgaard 2002
; This program will set the active profile to a profile
; with the same name as the login name. This is useful
; for multiple users of the same machine.
; Suggest creating an acaddoc.lsp and load and run
; by placing these lines in the acaddoc.lsp file.
; (load "set_profile")
; (c:set_profile)
(defun C:SET_PROFILE (/ PROFARRAY PROFOBJ )
(vl-load-com)
(setq PROFOBJ (vla-get-profiles
(vla-get-preferences
(vlax-get-acad-object)
)
)
)
(vla-Getallprofilenames PROFOBJ 'PROFARRAY)
(setq PROFILES (vlax-safearray->list PROFARRAY))
(if (not (wcmatch (getvar "loginname")
(vla-get-activeprofile PROFOBJ)
)
)
(if (member (strcase (getvar "loginname"))
(mapcar 'strcase PROFILES)
)
(vla-put-ActiveProfile PROFOBJ (getvar "loginname"))
(princ "\nNo profile saved for your login name: ")
)
)
(princ)
)
bradlyferrell
2006-06-26, 03:29 PM
Peter,
Thank you very much!!! I will load this up and see if it works for us. Where did you find this??
Mike,
1. Yes, I believe I browsed all of those links. My need is specific to the user's login.
2. Paths = the paths listed in Options for Support Files, Printer Files, Detail database, etc.
Beldin,
When/ If a user moves to a different machine, their desktop loads on 'that' machine.
kennet.sjoberg
2006-06-26, 07:48 PM
You mean like this?
I suppose not,
Peter you assume that the profile is present in the registry, it will fail when there is a new computer, or if the user start from an other “unused” client.
I think Bradly wants to load the “their own profile.arg” from a network location.
Here is how I do.
I import the login user profile as “temporary” from the network location.
Set the “temporary” profile as current
Erase the previous CurrentUser profile
Rename the “temporary” profile to CurrentUser
It means that there is always only one profile from the network location in the client registry.
The user can “SaveMyProfile” to the network location as LoginUser.arg when necessary.
: ) Happy Computing !
kennet
bradlyferrell
2006-06-26, 08:08 PM
I suppose not,
Here is how I do.
I import the login user profile as “temporary” from the network location.
Set the “temporary” profile as current
Erase the previous CurrentUser profile
Rename the “temporary” profile to CurrentUser
It means that there is always only one profile from the network location in the client registry.
The user can “SaveMyProfile” to the network location as LoginUser.arg when necessary.
kennet
kennet,
I don't quite follow you on your instructions. Is that all done manually or with a lsp routine?
You are correct about Peter's code...it assumes the profiles exist on each machine, which they do not.
Now, if the above code would reference the "windows login" of the user, then call that user's profile.arg from the network server & set that profile as current, when the user opened ADT, the settings, toolbars, etc. would be right for that user.
I realize it is just as easy to start ADT, then import the profile & set it current, but the boss wants it automatic, so a .lsp routine (at ADT startup) seems logical to accomplish that.
I am totally lost when it comes to writing routines, so maybe Peter could find time to edit his code http://forums.augi.com/images/icons/icon12.gif
Thanks for the help guys,
kennet.sjoberg
2006-06-26, 08:23 PM
kennet,
I don't quite follow you on your instructions. Is that all done manually or . . .
All is done automatic ( in my office ) when you start AutoCAD !
: ) Happy Computing !
BTW. there is a problem if you intend to run "ADT" and "ADT as AutoCAD" they may have different profiles.
bradlyferrell
2006-06-26, 08:40 PM
All is done automatic ( in my office ) when you start AutoCAD !
: ) Happy Computing !
BTW. there is a problem if you intend to run "ADT" and "ADT as AutoCAD" they may have different profiles.
All is done automatic by using a .lsp routine??
If so, is it possible to get a copy of your routine?
Thanks,
kennet.sjoberg
2006-06-26, 10:01 PM
All is done automatic by using a .lsp routine?? Yes.
If so, is it possible to get a copy of your routine?
Hey, the code is all over in this tread. Why not try to assembling it yourself ?
If you get lost I will help you. This is a very good start LINK (http://www.jtbworld.com/lisp/profiles.htm)
: ) Happy Computing !
kennet
bradlyferrell
2006-06-26, 11:20 PM
Yes.
Hey, the code is all over in this tread. Why not try to assembling it yourself ?
If you get lost I will help you. This is a very good start LINK (http://www.jtbworld.com/lisp/profiles.htm)
: ) Happy Computing !
kennet
LOL! I'll take that answer as a: No I can't share my code with you. http://forums.augi.com/images/icons/icon10.gif
I know too little about .lsp routines to assemble it from pieces. Besides that, I have way too much to do at work to be learning LISP.
We are currently looking for a new programmer, so until we find one, I am trying to find what we need to keep producing.
Thanks for your help though. That link will come in handy!
kennet.sjoberg
2006-06-27, 09:02 AM
LOL! I'll take that answer as a: No I can't share my code with you. http://forums.augi.com/images/icons/icon10.gif
I'll take that as an insult, that is definitly NOT the case, you can find a lot of my code in these forum to use.
. . .Besides that, I have way too much to do at work. . .
. . .and ? I suppose all of us have a lot of work to do.
This is an education forum, and not a "make me a program please" forum
Here is all code you need to asseble the program and put it in to a lisp file,
but you must try to understand what you are doing.
If not ask again.
(vl-load-com)
(setq ServerLocation "K:/MyPath/" ) ;; <<--- Your Server location
;;; Collect all named profiles
(vla-GetAllProfileNames (vla-get-profiles (vla-get-preferences (vlax-get-acad-object ))) 'ProfileCollection )
;;; Import "login users" profile as Temporary if exist
(if (findfile (strcat ServerLocation (getvar "LOGINNAME") ".arg" ))
(vla-ImportProfile
(vla-get-profiles (vla-get-Preferences (vlax-get-acad-object)) )
"Temporary"
(strcat ServerLocation (getvar "LOGINNAME") ".arg" )
T
)
( ) ;; "CurrentUser" LOGINNAME.arg do not exist
)
;;; Collect all named profiles again, maybe "Temporary" is added
(vla-GetAllProfileNames (vla-get-profiles (vla-get-preferences (vlax-get-acad-object ))) 'ProfileCollection )
;;; Set the Temporary profile current if exist
(if (member "Temporary" (vlax-safearray->list ProfileCollection ) )
(vla-put-activeprofile (vla-get-profiles (vla-get-Preferences (vlax-get-acad-object ))) "Temporary" )
( ) ;; Failed to load LOGINNAME.arg
)
;;; Delete the previous "CurrentUser" profile if it exist and if "Temporary" profile exist
(if (and (member "CurrentUser" (vlax-safearray->list ProfileCollection ) ) (member "Temporary" (vlax-safearray->list ProfileCollection )) )
(vla-deleteprofile (vla-get-profiles (vla-get-Preferences (vlax-get-acad-object ) )) "CurrentUser" )
( ) ;; "CurrentUser" or "Temporary" profile did not exist
)
;;; Rename the Temporary profile to CurrentUser if exist
(if (member "Temporary" (vlax-safearray->list ProfileCollection ) )
(vla-renameprofile (vla-get-profiles (vla-get-Preferences (vlax-get-acad-object ) )) "Temporary" "CurrentUser" )
( ) ;; "Temporary" profile did not exist
)
;;;;---------------------------------------------------------------------------------------------
(defun c:SaveMyProfile (/ )
;;; Export the current "login user" profile if exist, this must be manually done by the "owner" when necessary profile changes is done.
(vl-load-com)
(vla-GetAllProfileNames (vla-get-profiles (vla-get-preferences (vlax-get-acad-object ))) 'ProfileCollection )
(if (member "CurrentUser" (vlax-safearray->list ProfileCollection ) )
(vla-exportprofile
(vla-get-profiles (vla-get-Preferences (vlax-get-acad-object )) )
"CurrentUser"
(strcat ServerLocation (getvar "LOGINNAME") ".arg" )
)
( ) ;; "CurrentUser" do not exist
)
(princ)
)
;;; Initially the user must in Options Profiles Rename "prefered Current profile" to "CurrentUser"
;;;;---------------------------------------------------------------------------------------------
: ) Happy Computing !
kennet
peter
2006-06-27, 02:03 PM
Peter,
Thank you very much!!! I will load this up and see if it works for us. Where did you find this??
Mike,
1. Yes, I believe I browsed all of those links. My need is specific to the user's login.
2. Paths = the paths listed in Options for Support Files, Printer Files, Detail database, etc.
Beldin,
When/ If a user moves to a different machine, their desktop loads on 'that' machine.I write my own stuff.
Try this one that imports a profile from a network location.
; Written By: Peter Jamtgaard copr 2004
; This routine will load and set a profile
; From a Network location.
; Include / at end of Directory
(defun LoadProfile (strProfileName /
arrProfiles ; Array of profile names
lstProfiles ; List of Profile Names
objProfiles) ; Object Profiles Collection
(setq objProfiles (vla-get-profiles
(vla-get-preferences
(vlax-get-acad-object))))
(errortrap '(vla-importprofile objProfiles
strProfileName
(findfile (strcat strProfileName ".arg"))
:vlax-true))
(errortrap '(vla-put-ActiveProfile objProfiles strProfileName))
(prin1)
)
(defun ErrorTrap (symFunction / objError result)
(if (vl-catch-all-error-p
(setq objError (vl-catch-all-apply
'(lambda (X)(set X (eval symFunction)))
(list 'result))))
(if DEBUG
(progn
(princ (strcat "\n"
(vl-catch-all-error-message objError)
"\nWhile evaluating the expression: ")
(princ symfunction)
(princ "\n")
)
nil
)
(if result result 'T)
)
)
(princ)
bradlyferrell
2006-06-28, 03:58 AM
No, no kennet, please don't take that as an insult. What I meant was I have asked someone before if they could share their code and they said they could not or would have to ask their "boss" first. I don't get to visit this particular forum much (except when I need code experts help), so I haven't seen much of your code here. I meant no disrespect, I just assumed by your response that you were not able to share the code.
And yes, we all have a lot of work to do, hopefully. My skill is in drawing, my weakness is in programming. I agree with you on education and understanding what you are doing, I am just under a time line to get this done and was hoping someone could provide code so that I could learn from it when I do get the time.
You never know until you ask, right :)
Btw, thank you VERY much for the code. From what I can understand of it, it looks like that is what we need.
One question though. I understand when I see (defun c:SomeText () that "SomeText" is the command to run the routine. But, I am wondering how you run these routines that I see that say:
(vl-load-com). I have read some on 'com' but still don't understand what actually starts the routine.
This would greatly aid my understanding about LISP.
Peter, thank you again for more code.
I have split kennet's response from this thread. It was a good explanation of an AUTOLISP routine, that I felt it would help others as a sticky thread.
Good Job, kennet.
Richard
Forum Moderator
kennet.sjoberg
2006-06-29, 12:23 AM
I have split kennet's response from this thread. It was a good explanation of an AUTOLISP routine, that I felt it would help others as a sticky thread.
Good Job, kennet.
Richard
Forum Moderator
Very good !
I was on my way to ask you do that Opie, but you was faster than me !
Thank you and . . .
: ) Happy Computing !
kennet
BTW
If you wish and the other do not have any opposition against to remove :
- this post
- your post ( the move post )
- and bradlys ( excuse post ) and his post before that
you can do it
so the important "Autoload Specific User Profile .lsp" is a clear code thread.
I will then remove some unnecessary lines in my "profile post"
I'll let you two decide on which ones of your's and others' own posts need to be removed from this thread.
Again, good job.
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.