Check from which directory a *
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) (setq answer (getvar "dwgprefix"))
plus a "startup" lsp to change profile 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 (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 "PROFILE_ONE") (setq myProfName "PROFILE_TWO")) (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!
页:
[1]