GLAVCVS Posted 18 hours ago Posted 18 hours ago 5 minutes ago, GLAVCVS said: Maybe this will do what you need. defun c:LoadFolder (/ sh hwd carp slf pth lstAA a arch nmarch nmarchLL cno cns sl r l) (setq sl (getvar "SECURELOAD")) (SETVAR "SECURELOAD" 0) (if (setq sh (vla-getinterfaceobject (vlax-get-acad-object) "shell.application") hwd (vl-catch-all-apply 'vla-get-hwnd (list (vlax-get-acad-object))) carp (vlax-invoke-method sh 'browseforfolder (if (vl-catch-all-error-p hwd) 0 hwd) "Folder to load" 0 "") ) (if (setq slf (vlax-get-property carp 'self) pth (vlax-get-property slf 'path) pth (vl-string-right-trim "\\" (vl-string-translate "/" "\\" pth)) ) (if (setq lstAA (vl-directory-files pth "*.lsp")) (foreach a lstAA (if (not arch) (setq arch (open (setq nmarchLL (strcase (strcat (VL-REGISTRY-READ "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders" "Personal" ) "\\ListaLisps.lsp" ) ) ) "w" ) ) ) (load (strcat (setq cno (strcat pth "\\" a)))) ;;; (princ (strcat "\n" cno "... *** LOADED ***")) (write-line (strcat "(load \"" cno "\")") arch) ) ) ) ) (if arch (progn (close arch) ;;;;;; (startapp "notepad" nmarch) (princ (strcat "\n*** " (itoa (length lstAA)) " files LOADED ***")) (if (not (wcmatch (strcase pth) (setq cns (VLAX-get-property (setq prf (VLAX-get-property (vla-get-preferences (vlax-get-acad-object)) "files")) "SupportPath")))) (progn (vlax-put prf "SupportPath" (strcat cns ";" pth)) (princ (strcat "\n*** New SupportPath: " pth)) ) ) (setq nmarch (if (setq a (findfile "acad.lsp")) a (strcat (vl-filename-directory (findfile "acad.exe")) "\\Support\\acad.lsp"))) (if a (if (setq arch (open nmarch "r")) (progn (while (and (not r) (setq l (read-line arch))) (setq r (wcmatch (strcase l) "(LOAD \"LISTALISPS.LSP\")" ))) (close arch)))) (cond ((and a (not r)) (if (setq arch (open nmarch "a")) (progn (write-line "(LOAD \"LISTALISPS.LSP\")" arch) (close arch))) ) (a (princ) ) (nmarch (if (setq arch (open nmarch "w")) (progn (write-line "(LOAD \"LISTALISPS.LSP\")" arch) (close arch)))) (T (alert "Ocurrió lo inesperado")) ) (startapp "notepad" nmarch) ) ) (SETVAR "SECURELOAD" sl) (princ) ) And what does it do? The same as the previous command BUT ALSO: – it writes into 'acad.lsp' Lisp code to load, from the next startup onward, the file 'ListaLisps.lsp', which in turn calls the loading of all the Lisp files in the selected folder. – adds the location of the files to AutoCAD’s 'SupportPath'. 1 Quote
Lee Mac Posted 18 hours ago Posted 18 hours ago 2 hours ago, Nikon said: I use custom user names in acad.pgp, and for this the lisp files must be in the Startup Suite. Why not use the acaddoc.lsp instead? 1 Quote
Nikon Posted 18 hours ago Author Posted 18 hours ago 13 minutes ago, GLAVCVS said: And what does it do? The same as the previous command BUT ALSO: – it writes into 'acad.lsp' Lisp code to load, from the next startup onward, the file 'ListaLisps.lsp', which in turn calls the loading of all the Lisp files in the selected folder. – adds the location of the files to AutoCAD’s 'SupportPath'. Thanks for participating, I'll try this code. Quote
GLAVCVS Posted 18 hours ago Posted 18 hours ago @Nikon You should copy the code again. I didn't paste the code correctly. Also, I've also modified something. 1 Quote
Nikon Posted 17 hours ago Author Posted 17 hours ago 1 hour ago, GLAVCVS said: @Nikon You should copy the code again. I didn't paste the code correctly. Also, I've also modified something. I have checked the code, the files are uploaded to the drawing, but they are not uploaded to the startup. In the new file, I need to use the code again. Quote
GLAVCVS Posted 16 hours ago Posted 16 hours ago At the end of the command execution, the acad.lsp file opens. Make sure the full directory where "ListaLisps.lsp" is located appears. It's possible that when loading the previous code, only the file name was written. If this is the case, delete that line, save and close acad.lsp, and run the command again. Quote
Nikon Posted 16 hours ago Author Posted 16 hours ago (edited) 9 minutes ago, GLAVCVS said: At the end of the command execution, the acad.lsp file opens. Make sure the full directory where "ListaLisps.lsp" is located appears. It's possible that when loading the previous code, only the file name was written. If this is the case, delete that line, save and close acad.lsp, and run the command again. Something's wrong. A window appears Edited 16 hours ago by Nikon Quote
GLAVCVS Posted 16 hours ago Posted 16 hours ago This may be a directory permissions issue. Have you checked if the acad.lsp file exists? Quote
Nikon Posted 16 hours ago Author Posted 16 hours ago 4 minutes ago, GLAVCVS said: This may be a directory permissions issue. Have you checked if the acad.lsp file exists? acad2021.lsp file exists are acad.lsp file and acad2021.lsp file the same thing? Quote
Nikon Posted 16 hours ago Author Posted 16 hours ago (edited) 33 minutes ago, GLAVCVS said: They are different So I need to create an acad.lsp file? Would it be easier to add a list of Lisp programs directly to lisp for automatic loading? To avoid using the path to the .txt list. Edited 15 hours ago by Nikon Quote
GLAVCVS Posted 15 hours ago Posted 15 hours ago The solution may simply be to release write permissions for the 'Support' directory. If you search in Documents, you'll find the file 'ListaLisps.lsp'. It encodes the loading of all the files in the folder you selected when running the command. Therefore, you only need to load 'ListaLisps.lsp' to load all the other files. Quote
Nikon Posted 15 hours ago Author Posted 15 hours ago 4 minutes ago, GLAVCVS said: If you search in Documents, you'll find the file 'ListaLisps.lsp'. It encodes the loading of all the files in the folder you selected when running the command. Yes, the ListaLisps.lsp file has been created. Quote
GLAVCVS Posted 13 hours ago Posted 13 hours ago 3 hours ago, Nikon said: Something's wrong. A window appears Something important: AutoCAD may have been running without administrator privileges. Make sure of this. Quote
BIGAL Posted 12 hours ago Posted 12 hours ago I am still sticking with a menu option you can use Lisp to write menu code, it wont be 100% accurate but saves an enormous amount of typing and reduces creation time. Quote
ronjonp Posted 12 hours ago Posted 12 hours ago I'm still not understanding why this won't do the trick. I've been successfully loading files for 20+ years using a version of that code and a custom MNL tied to a partial CUI. Adding a bunch of lisp routines to the startup suite is not standard practice ( well at least in my little world : ) ) 2 Quote
Nikon Posted 4 hours ago Author Posted 4 hours ago I thank everyone once again and ask once again if it is possible not to use acad.lsp, MNL, CUI. You can simply add several lisp files from notepad to the startup or insert a list of files into the code so as not to specify the path. Quote
GLAVCVS Posted 3 hours ago Posted 3 hours ago I don't know of any way to load anything from a text file (or any other) other than calling some Lisp code from acad.lsp, acadDoc.lsp, acad####.lsp, acad####Doc.lsp, or from 'Start Suite'. An alternative to all this is a script. But it's not much different. 1 Quote
SLW210 Posted 45 minutes ago Posted 45 minutes ago AFAIK you need other than LISP to do exactly what you want. I doubt if anyone would do a lot of work for a one off program, as most use the already mentioned methods. Here are the recommended methods for doing this, most already mentioned. AutoCAD 2026 Help | About Auto-Loading and Running AutoLISP Routines | Autodesk You could use the Windows registry, maybe. Load lisp in Startup suite via lisp - AutoLISP, Visual LISP & DCL - AutoCAD Forums Lee Mac has a ACADDOC creator. ACADDOC.lsp Creator | Lee Mac Programming And an Autoloader LISP. Autoloader | Lee Mac Programming I agree with this. 1 Quote
Lee Mac Posted 38 minutes ago Posted 38 minutes ago @Nikon What are your reasons for not loading programs using the acaddoc.lsp (which can be easily manipulated programmatically), versus using the Startup Suite (which is difficult to manipulate programmatically)? 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.