Atmoz Posted January 20, 2011 Posted January 20, 2011 Dear all, To automatically switch profiles at startup I want to create a script that "looks" from which directory a *.DWG drawing is opened from. This detection script runs directly when AutoCAD starts up. If the user opens a drawing from c:\tek\ then "profile_one" has to be selected, and if the user opens a drawing from every other directory then "profile_two" must be selected. Please can you help me to "detect" from which directory a drawing is opened. Thanks in advance!! With kind regards, Atmoz (from the Netherlands, so excuses my English) Quote
BIGAL Posted January 21, 2011 Posted January 21, 2011 (setq answer (getvar "dwgprefix")) plus a "startup" lsp to change profile Quote
Atmoz Posted January 24, 2011 Author Posted January 24, 2011 Thanks for the reply! In the meanwhile I've had it working with VBA... MyDocument.FullName if Mid$(GeopendDocument, 1, 7) = "C:\tek\" then... else... end if With kind regards, Atmoz Quote
BlackBox Posted January 24, 2011 Posted January 24, 2011 (defun c:FOO (/ *profs* pNames profNameList myProfName) (vl-load-com) (if (and (setq *profs* (vla-get-profiles (vla-get-preferences (vlax-get-acad-object)))) (vla-getallprofilenames *profs* 'pNames) (setq profNameList (vlax-safearray->list pNames)) (vl-string-search "C:\\TEK\\" (strcase (getvar 'dwgprefix)))) (setq myProfName "[color=red]PROFILE_ONE[/color]") (setq myProfName "[color=red]PROFILE_TWO[/color]")) (if (vl-position myProfName profNameList) (progn (vla-put-activeprofile *profs* myProfName) (prompt (strcat "\n >> Profile \"" myProfName "\" Has Been made Active! "))) (prompt (strcat "\n <!> Profile \"" myProfName "\" Cannot Be Found <!> "))) (princ)) :: Untested :: Hope this helps! Quote
Recommended Posts
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.