Startup in acad2000doc.lsp

Discussion in 'AutoCAD' started by ptti, Feb 4, 2004.

  1. ptti

    ptti Guest

    Hello Everyone! I searched this forum and found that to have vba code to be ran whenever AutoCAD is launched, to place it in the acad2000doc.lsp file. So I placed the following code in this file:

    (defun S::STARTUP()
    (command "._vbastmt" "startup")
    )

    Whenever I open up some files it works ok and other files it gives me a FATAL ERROR: Unhandled Access Violation Reading 0x0052 Exception at 12818950h error. Am I doing this incorrectly? Does anyone have any other ideas? I also am getting this error when I double-click on a file:

    Cannot find the file "filename" (or one of its components). Make sure the path and filename are correct and that all required libraries are available.

    Any ideas on this error as well?

    Thanks in advance.
     
    ptti, Feb 4, 2004
    #1
  2. ptti

    ptti Guest

    I forgot to mention that the "startup" in the lisp function is the name of a vba function that I want called. I also placed in the name of a different function name and it still gave me the error.
     
    ptti, Feb 4, 2004
    #2
  3. Ptti,

    You really need to read up on your help files for VBA in AutoCAD - could
    save you allot of trial and error! :) Also you'll get a much faster
    response in the VBA Customization NG:
    (autodesk.autocad.cutomization.vba)

    First, you should not load vba programs with "vbastmt". Both the AutoCAD
    command line and Visual LISP have methods specifically for loading VBA. Look
    up (vl-vbaload) and (vl-vbarun) in the AutoLISP reference:

    (defun S:Startup ()
    (vl-load-com)
    (vl-vbaload "startup.dvb")
    (vl-vbarun "startup")
    )

    Second, you should not use (command) within the S:STARTUP function. This has
    been as rule since R2000.
     
    Phil Kenewell, Feb 4, 2004
    #3
  4. ....
    Second, you should not use (command) within the S:STARTUP function. This has
    been as rule since R2000.


    That has *never* been a rule. Where did you get that idea? Look at the
    samples for S::Startup in the docs for instance.
     
    R. Robert Bell, Feb 4, 2004
    #4
  5. Oops!

    You're right Robert - I must have been thinking of something else. Reactors
    maybe?
     
    Phil Kenewell, Feb 4, 2004
    #5
  6. Phil Kenewell, Feb 4, 2004
    #6
  7. Possibly. ;^)

    --
    R. Robert Bell, MCSE
    www.AcadX.com


    Oops!

    You're right Robert - I must have been thinking of something else. Reactors
    maybe?
     
    R. Robert Bell, Feb 5, 2004
    #7
  8. R. Robert Bell, Feb 5, 2004
    #8
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.