load and run

Discussion in 'AutoCAD' started by Chuck, Mar 8, 2006.

  1. Chuck

    Chuck Guest

    I have a lot of lisp routines that are started by the same name as the lisp
    name. i.e.
    file name caps.lisp is (defun c:caps ().........,
    met.lsp is (defun c:met ()........,any.lsp is (defun c:any.....etc.
    The name of the lisp file is the same as the string that must be entered to
    run it once it is loaded.
    In a tool macro (load "caps") caps would load and then run the caps
    lisp routine. I do not want to create a separate tool for each lisp routine,
    but rather one that will accept a variable name and the load the lisp
    routine using the variable name then run it using the same variable name.
    I've tried a macro like this:
    ((setq vname (getstring "\nFile Name to load: ")(load vname)) (vname)

    The idea is that when I press the button the following prompt would appear

    Command: File Name to load:
    enter: caps
    and this would load then run caps.lsp.

    similarly

    Command: File Name to load:
    enter: met
    and this would load then run met.lsp.

    similarly

    Command: File Name to load:
    enter: any
    and this would load then any any.lsp.

    etc. all using the same tool.

    ------------------------------------------------------------------------------------------------------------------

    Check out the history below

    --------------------------------------------------------------------------------------------------------------------
    Command:
    Command: (setq vname (getstring "\nFile to load And Run: "))(load vname)

    File to load And Run: cap
    C:CAP

    Command: cap

    Select object:
    Command:

    ---------------------------------------------------------------------------------------------------------------------

    This works great it loads the cap.lsp file using an alias vname....then I
    type in cap again and it runs the cap.lsp file.

    I don't want to type in cap again I want to run cap by means of the same
    vname alias.

    check the history below

    ------------------------------------------------------------------------------------------------------------------------

    Command:
    Command: (setq vanme (getstring "\nFile to load And Run: "))(load
    vname)(vname)

    File to load And Run: cap
    ; error: bad function: "cap"
     
    Chuck, Mar 8, 2006
    #1
  2. Chuck

    Chuck Guest

    so what would my button macro be? I've tried this.

    (setq vname (getstring "\nFile to load and run "))(load vname)((strcat
    "c:" vname))

    No luck
     
    Chuck, Mar 8, 2006
    #2
  3. Chuck

    Chuck Guest

    Now we're back to having to type in caps twice. If I run (setq vname
    (getstring "\nFile to load and run "))(load vname) the return prompt will be
    File to load and run:
    Then I enter caps on the command line the return prompt is
    C:Caps
    Then to run Caps I will need to type in Caps again on the command line.
    It's this last step I am trying to eliminate. I've already typed in caps
    once and I would like to eliminate the need to type it in again.
     
    Chuck, Mar 10, 2006
    #3
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.