Running app on Acad startup

Discussion in 'AutoCAD' started by Andrew Rowe, Dec 29, 2003.

  1. Andrew Rowe

    Andrew Rowe Guest

    Hi group:
    I am trying to write a simple application in VB6 to log autocad drawings
    being opened in the journal in Outlook similar to how it logs office
    documents. Creating a journal entry in outlook is no problem. The problem is
    accessing the autocad object on autocad start up. I have been placing a
    (startapp "myapp") line in the acad2000.lsp or acad2000doc.lsp file to start
    the application. This works fine but the line
    Set ACApp = GetObject(, "Autocad.Application")
    throws an error. Seems the acad object is not available yet. If autocad is
    already open, it works fine on subsequently opened files. If I place a line
    MsgBox "Starting Drawing Log program"
    it doesn't throw an error, seems the message box releases control long
    enough for acad to finish loading. I've run into this problem before trying
    to get an application to run on acad start up. Does anyone have any ideas on
    this topic? Any help is greatly appreciated.
     
    Andrew Rowe, Dec 29, 2003
    #1
  2. Andrew Rowe

    Andrew Rowe Guest

    To do that wouldn't the vba routine have to be embedded in every drawing the
    user might open?
    I thought about a VBA solution, placing the routine in the drawing template,
    but I want the application to work on any drawing, even ones sent to us by
    other offices and need no interaction from the user. Also, I find VBA buggy
    and not as powerful then VB.
    This problem has been a real stumbling block for me. There are a number of
    things I would like to be able to do programically upon autocad start up.
     
    Andrew Rowe, Dec 29, 2003
    #2
  3. Andrew Rowe

    Ed Jobe Guest

    To get code to work on startup of acad, create a new project and name the
    file "acad.dvb". Then in a public module, create a public sub called
    "AcadStartup" and place your code there. You can do things directly there,
    load other dvb's or call other procedures, etc.
     
    Ed Jobe, Dec 29, 2003
    #3
  4. Hi Andrew,

    Why not write your Application in VBA and have it respond to the finish
    event of open drawing ?

    --


    Laurie Comerford
    CADApps
    www.cadapps.com.au
     
    Laurie Comerford, Dec 29, 2003
    #4
  5. In addition, you can always cobble together a small LISP routine to
    create an instance of your application then add the LISP routine to your
    startup suite. I prefer this method since it avoids collisions. If the
    end user already has an acad.dvb, they'd have toedit it in order to get
    your application going.

    --
    There are 10 kinds of people. Those who understand binary and those who
    don't.

    http://code.acadx.com
    (Pull the pin to reply)
     
    Frank Oquendo, Dec 29, 2003
    #5
  6. Andrew Rowe

    Dave Guest

    If that does not work you can always initialize the vb dll with an event
    trigger. Enter and mouse click It works pretty well in 2000-2002.


    The acad.dvb will autoload, but I try and stay away from files like that
    because it's the easy way to force a file to load and everybody uses those
    files and conflicts are frequent. but either way I do not think it will fix
    your particular problem.

    Dave
     
    Dave, Dec 29, 2003
    #6
  7. Andrew Rowe

    Ed Jobe Guest

    As for the other part of your problem,
    If your app is in vba, the application object will be accessible.
    If your app is in vb, create a Application property. Then, as Frank noted,
    when you start your app in lisp, use (vlax-get-acad-object) to set your
    app's Application property.
     
    Ed Jobe, Dec 29, 2003
    #7
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.