Jump to content

Sharing! AutoStartup


AIberto

Recommended Posts

Source from : bbs.xdcad.org , by st788796

 

(defun XD::AutoStartup (path tf / Profiles allpro newnum AutoLoadpath)
 (vl-load-com)
 (if tf
   (progn
     (vla-getallprofilenames
(vla-get-profiles
  (vla-get-preferences (vlax-get-acad-object))
)
'Profiles
     )
     (setq allpro (safearray-value Profiles))
   )
   (setq allpro (list (getvar "cprofile")))
 )
 (setenv "ACAD"
  (strcat (getenv "ACAD") ";" (vl-filename-directory path))
 )
 (if (wcmatch (getvar "acadver") "19.[1-9]*")
   (if tf
     (mapcar '(lambda (x / trpath)
  (setq trpath (strcat
   "HKEY_CURRENT_USER\\"
   (vlax-product-key)
   "\\Profiles\\"
   x
   "\\Variables"
        )
  )
  (vl-registry-write
    trpath
    "Trustedpaths"
    (strcat (vl-registry-read trpath "Trustedpaths")
     ";"
     (vl-filename-directory path)
     "\\..."
    )
  )
       )
      allpro
     )
     (setvar "TRUSTEDPATHS"
      (strcat (getvar "TRUSTEDPATHS")
       ";"
       (vl-filename-directory path)
       "\\..."
      )
     )
   )
 )
 (mapcar '(lambda (x)
     (setq AppLoadPath
     (strcat
       "HKEY_CURRENT_USER\\"
       (vlax-product-key)
       "\\Profiles\\"
       x
       "\\Dialogs\\Appload\\Startup"
     )
     )
     (setq
       NewNum
 (itoa
   (1+ (read
  (vl-registry-read AppLoadPath "NumStartup")
       )
   )
 )
     )
     (vl-registry-write AppLoadPath "NumStartup" NewNum)
     (vl-registry-write
       AppLoadPath
       (strcat NewNum "Startup")
       path
     )
   )
  allpro
 )
 (princ)
)

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...