Autorun Autolisp

Discussion in 'AutoCAD' started by Ryan Rawlins, Jan 14, 2005.

  1. Ryan Rawlins

    Ryan Rawlins Guest

    Is there a way to set a lisp routine to load and run when a document loads
    from the acaddoc.lsp file?
     
    Ryan Rawlins, Jan 14, 2005
    #1
  2. Ryan Rawlins

    TCEBob Guest

    Sure. I have several. Just after the code for the routine insert another routine
    calling it.

    (defun c:mylisp()
    .. . .
    (princ))

    (c:mylisp) ;run it

    rs
     
    TCEBob, Jan 14, 2005
    #2
  3. Ryan Rawlins

    Tom Smith Guest

    Another way is to use an s::startup function. This executes automatically after everything else is loaded.
     
    Tom Smith, Jan 15, 2005
    #3
  4. Option: Use a Startup Suite.

    appload/startup suite/contents/add

    []s,

    Rogério
     
    Rogerio_Brazil, Jan 15, 2005
    #4
  5. Ryan Rawlins

    Tom Smith Guest

    That doesn't address the question. OP wants the lisp to load AND run, not just load.

    Startup suite is only a different way to autoload, and not the best one IMHO. OP mentions using acaddoc.lsp, which is a more portable way of achieving autoloading.
     
    Tom Smith, Jan 15, 2005
    #5
  6. Oh yes. Sorry.

    How to use s::startup, and whit file contain a function?

    :)

    Rogério
     
    Rogerio_Brazil, Jan 16, 2005
    #6
  7. Ryan Rawlins

    Tom Smith Guest

    I do not have the help docs handy, but I think it is well documented. The (s::startup) function can be loaded anywhere in your startup sequence, for instance in acaddoc.lsp or an mnl file. Any code in this function will be executed after all other lisps, menus, etc. are loaded. This can be an advantage as it will always be the last thing to happen when a drawing opens.

    Vanilla Acad doesn't include an (s::startup) function, but it may present in a vertical product or customized system. Therefore it is recommended that your code checks for existence of this function, and if found, append your code to the end of it, as shown in help.
     
    Tom Smith, Jan 16, 2005
    #7
  8. Ryan Rawlins

    Ryan Rawlins Guest

    Thanks, That got me headed in the right direction.
     
    Ryan Rawlins, Jan 17, 2005
    #8
  9. Ryan Rawlins

    Ryan Rawlins Guest

    Obrigado por sua ajuda
     
    Ryan Rawlins, Jan 17, 2005
    #9
  10. Ryan Rawlins

    Ryan Rawlins Guest

    Thanks to all. I got it to work
     
    Ryan Rawlins, Jan 17, 2005
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.