How to RUN (not loading) lisp on startup?

aridzv
edited December 2022 in LISP
Hi.
I'm trying to run a lisp that load line types on startup.
I added the lisp to the appload.dfs file through the MANAGE tab and after startup if I type the command it run's.
I need help with make this lisp to run on startup so the line types will load automaticaly without the need to manually run the command.
I've searched for S::STARTUP but couldn't find a solution.

I've also attched here the lisp i'm trying to run.

thanks,
aridzv.

edit:
well,after finding this thread I've done the following:

1. in settings I added to my search path the path to the folder where my LSP files are.
2. I've created the on_start.lsp file in the "C:\Users\USER\AppData\Roaming\Bricsys\BricsCAD\V23x64\en_US\Support" folder.
3. in on_start.lsp file I added 2 lines of code:
(load "llt") ;; load the LSP file
(command "llt") ;; run the command

the reason to use on_start.lsp instand of the on_doc_load.lsp is that on_start.lsp loads only once upon openig the software while the on_doc_load.lsp load for every new drawing file opning.

hope it will help others.

Comments

  • Anthony Apostolaros
    edited December 2022
    (defun fname () ...whatever...) creates a new lisp function called fname,
    and ...whatever... specifies what fname will do when invoked.

    So keep the code you posted in your automatically-loading lisp file, but delete the first and last line. Then the code won't define a new custom command called LLT, but will simply do what LLT would have done when invoked.

    The automatically-loading lisp file I use is On_Doc_Load.lsp. I've never heard of appload.dfs, but it sounds like it works for you.
  • aridzv
    edited December 2022
    @Anthony Apostolaros
    thanks for the reply.
    I've enterd the code like you wrote (without the first and last line of the lisp) this way:

    (foreach lt '("Center" "Center2" "Centerx2" "Hidden" "Hidden2" "Hiddenx2")
    (if(not(tblsearch "ltype"lt))
    (command "_.-linetype" "_l" lt "iso.lin" "")
    ); end if
    ); end foreach
    (princ)

    And it did work (the code did what it was supposed to do, and didn't define a new custom command called LLT -
    Just what I needed!!...).
    many thanks,
    aridzv

    edit:
    about appload.dfs - This is for lazy people... :D
    the idea is that you go to Manage tab -> Load Application and choose wich LSP files will automaticlly load every time the software is starting.
    1. many people don't know how to write this kind of code and where.
    2. And for those who knew it still saves having to go to the ON_DOC_LOAD file writing code...
  • aridzv said:

    ....
    about appload.dfs - This is for lazy people...
    the idea is that you go to Manage tab -> Load Application and choose wich LSP files will automaticlly load every time the software is starting.
    ....

    I do use the Load Application tool. I just didn't know it created a file called appload.dfs.

    When I started in CAD, the on_doc_load.lsp file was the only way to do it. When I started using the Load Application tool, I assumed it was making changes to that old file, in the same way that the new Command Aliases tab of the Customize pallet made changes to my old default.pgp file. But I never opened the file to check. I probably haven't opened my on_doc_load.lsp file in over 20 years.
  • @Anthony Apostolaros
    I was a little humoristic in my last reply...
    I find the Load Application tool to be a very useful tool,
    and I use it alot to both keep the lisp's I need to load and to quickly load lisp for checking and unload them if needed.
    this information is obviously saved somewhere,and this "somewhere" is the appload.dfs file.
    in bricscad the Load Application tool tab point to that file and for me it is very helpfull because some times I just edit this file directly.