Jump to content

Is there a way to remove all .lsp from the startup suite via lisp?


Lt Dan's legs

Recommended Posts

I'm switching over to the acaddoc.lsp method of loading lisps. I'm starting to have problems with the startup suite (failing to load all lisps within). Is there a way to remove all .lsp from the startupsuite via lisp? No luck finding in the help file..

Link to comment
Share on other sites

  • Replies 33
  • Created
  • Last Reply

Top Posters In This Topic

  • irneb

    8

  • Lt Dan's legs

    7

  • Lee Mac

    6

  • BlackBox

    4

Top Posters In This Topic

Posted Images

Well found Kruuger :thumbsup:

 

In code that path would be:

(strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "\\Profiles\\" (getvar 'CPROFILE) "\\Dialogs\\Appload\\Startup")

 

But be careful when directly modifying the registry in this way, and also don't delete the "NumStartup" key.

Link to comment
Share on other sites

like this??

 

(
 (lambda ( ext )
   (foreach x (vl-registry-descendents ext "")
     (and (not (eq (strcase x) "NUMSTARTUP"))
       (vl-registry-delete ext  x)
     )
   )
 )
 (strcat "HKEY_CURRENT_USER\\" (vlax-product-key) "[url="file://profiles//"]\\Profiles\\[/url]" (getvar 'CPROFILE) "[url="file://dialogs//Appload//Startup"]\\Dialogs\\Appload\\Startup[/url]")
)

 

 

__Edit__

This isn't it...

Link to comment
Share on other sites

So you could try something like this?:

(vl-load-com)

(defun MoveStartup2ACadDoc (/ f key val)
 (if (or (and (setq f (findfile "acaddoc.lsp"))
              (setq f (open f "a"))
         )
         (and (setq f (getenv "ACAD"))
              (setq f (substr f 1 (vl-string-search ";" f)))
              (or (wcmatch f "*\\")
                  (setq f (strcat f "\\"))
              )
              (setq f (strcat f "acaddoc.lsp"))
              (setq f (open f "w"))
         )
     )
   (progn
     (foreach val (vl-registry-descendents
                    (setq key (strcat "HKEY_CURRENT_USER\\"
                                      (vlax-product-key)
                                      "\\Profiles\\"
                                      (getvar 'CPROFILE)
                                      "\\Dialogs\\Appload\\Startup"
                              )
                    )
                    "*"
                  )
       (cond
         ((eq val "NumStartup") (vl-registry-write key val "0"))
         ((wcmatch val "*Startup")
          (write-line (strcat "(load \"" (vl-registry-read key val) "\" nil)") f)
          (vl-registry-delete key val)
         )
       )
     )
     (close f)
   )
 )
)

Link to comment
Share on other sites

Thanks for the reply

The code above returns the lisps but does not remove them from the startup suite.

 

found something

 

     (foreach val (vl-registry-descendents
                    (setq key (strcat "HKEY_CURRENT_USER\\"
                                      (vlax-product-key)
                                      "\\Profiles\\"
                                      (getvar 'CPROFILE)
                                      "\\Dialogs\\Appload\\Startup"
                              )
                    [color=darkred][b])
                         "*"[/b][/color]

Link to comment
Share on other sites

You will probably need to restart AutoCAD after modifying the registry.

 

That didn't didn't work... Umm :unsure:

 

 

__Edit__

 

Irneb your lisp wrote the lisps to the acaddoc.lsp but It did not delete the them from the startup suite

Link to comment
Share on other sites

found something
Yep thanks, corrected in my post.

 

Strange it should basically read all those values, modify the NumStartup to 0 and write all the LSP files to the acaddoc.lsp as load statements, then delete the registry value.

 

You'll definitely need to restart ACad, it generally doesn't update its settings when changed from something else than its "normal" methods.

Link to comment
Share on other sites

Anyone else test Irneb's lisp? Maybe I'm doing something wrong..

 

 

__edit__

 

found one more thing Irneb.

 

the lisp writes the acaddoc.lsp

(LOAD "C:\lisp1.lsp" nil)

 

and it should be

(LOAD "C:\\lisp1.lsp" nil)

Link to comment
Share on other sites

Irneb your lisp wrote the lisps to the acaddoc.lsp but It did not delete the them from the startup suite

 

You may also need to press F5 to refresh the registry to see the changes. Also, ensure you have the permissions to modify the registry.

 

A quick mod of Irneb's code:

 

(vl-load-com)

(defun MoveStartup2ACADDOC ( / f key val )
   (if
       (or
           (and
               (setq f (findfile "acaddoc.lsp"))
               (setq f (open f "a"))
           )
           (and
               (setq f (getenv "ACAD"))
               (setq f (substr f 1 (vl-string-search ";" f)))
               (or (wcmatch f "*\\")
                   (setq f (strcat f "\\"))
               )
               (setq f (strcat f "acaddoc.lsp"))
               (setq f (open f "w"))
           )
       )
       (progn
           (foreach val
                (vl-registry-descendents
                    (setq key
                        (strcat "HKEY_CURRENT_USER\\"
                            (vlax-product-key)
                            "\\Profiles\\"
                            (getvar 'CPROFILE)
                            "\\Dialogs\\Appload\\Startup"
                        )
                    )
                    "*"
                )
                (cond
                    (   (eq val "NumStartup")
                        (vl-registry-write key val "0")
                    )
                    (   (wcmatch val "*Startup")
                        (write-line (strcat "(load " (vl-prin1-to-string (vl-registry-read key val)) " nil)") f)
                        (vl-registry-delete key val)
                    )
                )
           )
           (close f)
       )
   )
   (princ)
)

 

EDIT: A quick test indicates this method won't work.

 

The paths are indeed removed from the registry, but rewritten when AutoCAD is restarted - back to the drawing board (excuse the pun)

Link to comment
Share on other sites

press F5 when viewing the desktop? If so, it did not work. I'll try to restart the computer and see if that works.

Link to comment
Share on other sites

Restarting worked!

I wanted to run this without going to everyone's station so restarting is the way to go for me.

 

Thanks All!!

Link to comment
Share on other sites

you should also consider acad.mnl with autoload rather loading many files to acaddoc.lsp

k.

I'd stay away from that one. Perhaps you mean the Custom.mnl? Although it would probably work, it's much like you changing the acad.cui(x) ... might get overwritten by an update.

 

Actually I prefer making my own CUI and its accompanying MNL. Much more "robust": If the menu's loaded you know your MNL has also loaded (even if it's not on the support paths).

 

As to this "rewriting" the Startup suite. It only does so if you open the startup suite before closing ACad. So run my code (or rather Lee's mod), close ACad immediately. By all means press F5 in RegEdit to refresh (or simply change folders back-and-forth), this isn't needed for it to work though.

 

Here's a test on mine: Started with some LSP's loaded through the Startup Suite.

capture_08012011_170522.png

 

You can see they're in the registry.

capture_08012011_170552.jpg

 

Then opened VLIDE with my defun and the current acaddoc.lsp. Run my code direct in the console. Note the acaddoc.lsp gets altered and VLIDE notifies you of such:

capture_08012011_170737.jpg

 

After which the 3 files are appended to the acaddoc.lsp. Here's where Lee's mod makes for a fix. Note mine only had single backslashes:

capture_08012011_170809.png

 

Close ACad. Open the RegEdit (press F5 if it was already open):

capture_08012011_170838.jpg

 

Reopen ACad (make sure the previous session had already closed - check the running processes in Task Manager). Open the Startup Suite ... they're gone:

capture_08012011_170926.png

 

Though Lee's mod fixes the double backslash issue.

Link to comment
Share on other sites

Guest kruuger

Acad,mnl works very well (plus some Custom.mnl also). Usually i overwrite this file adding new lisp. File is keep on server for safety (no wory about "clean" it by autocad).

I think it is better load file "on demand" rather loading hundreds files thru adacdoc.lsp

kruuger

Link to comment
Share on other sites

Acad,mnl works very well (plus some Custom.mnl also). Usually i overwrite this file adding new lisp. File is keep on server for safety (no wory about "clean" it by autocad).

I think it is better load file "on demand" rather loading hundreds files thru adacdoc.lsp

kruuger

 

Have you tried AutoLoader?

 

If I keep this up, I might as well have a sales position... Just saying. :lol: LoL

Link to comment
Share on other sites

Guest kruuger
Have you tried AutoLoader?

 

If I keep this up, I might as well have a sales position... Just saying. :lol: LoL

hehe :D of course. i'm checking Lee's page every day for new cool stuff.

i try to omit using "load" beacuse this may slow down opening autocad/new dwg (especially when we got some routine with (princ "...") at the end.

kruuger

Link to comment
Share on other sites

@ Kruuger - I usually comment out all load messages (if not my routines), but leave them in the source code for attribution.

 

@ Irneb & Lee - Great job guys; it's educational to see your problem solving unfold.

 

Cheers! :beer:

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