Run VBA project from commadline

Discussion in 'AutoCAD' started by kb, Apr 1, 2005.

  1. kb

    kb Guest

    Hi,

    I have a VBA application that is automatically loaded in Autocad within the acad2005.lsp file. I can then type the key would in the command line to lauch the application and run it.

    (if (not (= (substr (ver) 1 11) "Visual LISP")) (load "acad2005doc.lsp"))

    ;; Silent load.
    (princ)

    (defun C:Run_Update()
    (command"_-vbarun" "D:\\My_APPlication1\\MainProject.dvb!ShowMainForm")

    (princ)
    )

    But now I have built another VBA application that I would like to auto load, and run in the same manner. So the user would type in Run_Update_new in the command line and it would start a different VBA applciation.

    How do I can another app to do this? I tried the below code, which didn't work:

    (if (not (= (substr (ver) 1 11) "Visual LISP")) (load "acad2005doc.lsp"))

    ;; Silent load.
    (princ)

    (defun C:Run_Update()
    (command"_-vbarun" "D:\\My_APPlication1\\MainProject.dvb!ShowMainForm")

    (defun C:Run_Update_new()
    (command"_-vbarun" "D:\\My_APPlication2\\MainProject2.dvb!ShowMainForm2")

    (princ)
    )

    Ultimately, i would like the to add a custom botton on the users machine so they would just push a button and not have to type anything in.

    Any ideas?

    Thanks,
    kb
     
    kb, Apr 1, 2005
    #1
  2. kb

    Dave Guest

    You can make a lisp file referencing your macros. The ones below call a dvb
    file and the dvb file in turn, calls a classmodule in an ActiveX dll. Yours
    could probably just call your rutine macro name in your dvb and it will run.
    This lisp is loaded int he startup suite and is created on the fly with the
    installer.

    Hope it helps and have a good weekend.


    ;smd
    (defun c:sd() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.start_demo"))
    (princ)
    (defun c:sset() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.show_settings")
    )
    (princ)
    (defun c:vo() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.showonlyselecte
    d"))
    (princ)
    (defun c:ho() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.hideselectedent
    ities"))
    (princ)
    (defun c:ao() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.showallentities
    "))
    (princ)
    (defun c:33() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.update"))
    (princ)
    (defun c:edxf() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExportDXF"))
    (princ)
    (defun c:edwg() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExportDWG"))
    (princ)
    (defun c:c2c() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.C2C"))
    (princ)
    (defun c:slx() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ExplodeAssembly
    "))
    (princ)
    (defun c:sm() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Move"))
    (princ)
    (defun c:sco() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Copy"))
    (princ)
    (defun c:sg() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Group"))
    (princ)
    (defun c:slmat() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Material"))
    (princ)
    (defun c:ATP() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.ATP"))
    (princ)
    (defun c:SLSEC() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.Section"))
    (princ)
    (defun c:SLV() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.MakeView"))
    (princ)
    (defun c:SLF() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.FreezeSections"
    ))
    (princ)
    (defun c:SLT() (command "-vbarun" "D:/Program
    Files/SmartListerDemo/Support/SmartListerDemoMenu.dvb!mStart.UNFreezeSection
    s"))
    (princ)
    ;/smd
    --
    David Wishengrad
    President & CTO
    MillLister, Inc.
    Software for BOM, measuring, stretching, feature recognition, and
    controlling visibility of
    multiple 3D solids.
    Http://Construction3D.com
     
    Dave, Apr 2, 2005
    #2
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.