Jump to content

Recommended Posts

Posted (edited)

Good day everyone!
I want to add several lisp files to the startup at once. I have a list of lisp files in notepad, in the Support folder.
The code returns an error: no function definition: VLA-GET-STARTUPSUITE
 

(defun c:add-list-lisps-to-startup ( / file line folder fullpath app ssuite )
  (vl-load-com)

  ;; The folder where the LISP files are located
  (setq folder "C:/Program Files/Autodesk/AutoCAD 2021/Support/")

  ;; Opening the list file
  (setq file (open "C:/Program Files/Autodesk/AutoCAD 2021/Support/list_startup.txt" "r"))

  (if file
    (progn
      ;; Getting the object Application
      (setq app (vlax-get-acad-object))

      (setq ssuite (vla-get-StartupSuite app))

      (while (setq line (read-line file))
        
       (setq line (vl-string-trim " \t\r " line))
        (if (and line (> (strlen line) 0))
          (progn
            (setq fullpath (strcat folder line))
            (if (findfile fullpath)               
              (progn
                (vla-Add ssuite fullpath)          
                (princ (strcat "Added to auto-upload: " fullpath))
              )
              (princ (strcat "File not found: " fullpath))
            )
          )
        )
      ) ; end while

      (close file)
      (princ "All files from the list have been processed.")
    ) ; end progn
    (princ "Couldn't open the list file.")
  ) ; end if

  (princ)   
) ; end defun

 

Edited by Nikon
Posted (edited)

That is because that is an AI generated function that does not exist. Rather than add them to the startup suite, just load them using one lisp file:

(defun loadlisp	(path / lst pth)
  (if (and (setq pth (strcat (vl-string-right-trim "\\" path) "\\"))
	   (setq lst (vl-directory-files pth "*.lsp" 1))
      )
    (foreach x (mapcar 'vl-filename-base lst) (vl-catch-all-apply 'load (list (strcat pth x))))
  )
  (princ)
)
(loadlisp "C:\\Program Files\\Autodesk\\AutoCAD 2021\\Support\\")

 

Easy to inspect in the vlide:

image.png.276be50e3e91f637adcc860e86843166.png

Edited by ronjonp
Posted
43 minutes ago, ronjonp said:

Rather than add them to the startup suite, just load them using one lisp file:

I need to add 50 lisp programs  to autoload...

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