Lt Dan's legs Posted August 1, 2011 Posted August 1, 2011 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.. Quote
Guest kruuger Posted August 1, 2011 Posted August 1, 2011 i not 100% sure but you can try to clean this path. k. Quote
Lee Mac Posted August 1, 2011 Posted August 1, 2011 Well found Kruuger 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. Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 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... Quote
irneb Posted August 1, 2011 Posted August 1, 2011 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) ) ) ) Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 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] Quote
Lee Mac Posted August 1, 2011 Posted August 1, 2011 You will probably need to restart AutoCAD after modifying the registry. Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 You will probably need to restart AutoCAD after modifying the registry. That didn't didn't work... Umm __Edit__ Irneb your lisp wrote the lisps to the acaddoc.lsp but It did not delete the them from the startup suite Quote
irneb Posted August 1, 2011 Posted August 1, 2011 found somethingYep 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. Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 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) Quote
Lee Mac Posted August 1, 2011 Posted August 1, 2011 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) Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 press F5 when viewing the desktop? If so, it did not work. I'll try to restart the computer and see if that works. Quote
Lee Mac Posted August 1, 2011 Posted August 1, 2011 press F5 when viewing the desktop? No, when viewing the registry (that is, if you have left regedit open) - but see my edit above. Quote
Lt Dan's legs Posted August 1, 2011 Author Posted August 1, 2011 Restarting worked! I wanted to run this without going to everyone's station so restarting is the way to go for me. Thanks All!! Quote
Guest kruuger Posted August 1, 2011 Posted August 1, 2011 you should also consider acad.mnl with autoload rather loading many files to acaddoc.lsp k. Quote
irneb Posted August 2, 2011 Posted August 2, 2011 you should also consider acad.mnl with autoload rather loading many files to acaddoc.lspk. 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. You can see they're in the registry. 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: 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: Close ACad. Open the RegEdit (press F5 if it was already open): Reopen ACad (make sure the previous session had already closed - check the running processes in Task Manager). Open the Startup Suite ... they're gone: Though Lee's mod fixes the double backslash issue. Quote
Guest kruuger Posted August 2, 2011 Posted August 2, 2011 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 Quote
BlackBox Posted August 2, 2011 Posted August 2, 2011 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 Quote
Guest kruuger Posted August 2, 2011 Posted August 2, 2011 Have you tried AutoLoader? If I keep this up, I might as well have a sales position... Just saying. LoL hehe 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 Quote
BlackBox Posted August 2, 2011 Posted August 2, 2011 @ 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! 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.