load and run

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"
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Place the command in the form (c:cap) as the last line in you lisp file and it will run immediately after loading.
--
Patrick Hughes

Engineered Design Solutions
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
eliminate ((strcat "c:" vname))
--
Patrick Hughes

Engineered Design Solutions
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
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.

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
Well, like I mentioned in my first post - in your .lsp file the very last line should be:
(c:caps)
Then, when the fill is loaded it will automatically run. This is assuming each function is it's own file.
An alternative is to use the autoload feature in your .mnl file and just type the command at the command line.
--
Patrick Hughes

Engineered Design Solutions
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.