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"

Reply to
Chuck
Loading thread data ...

Place the command in the form (c:cap) as the last line in you lisp file and it will run immediately after loading.

Reply to
Patrick Hughes

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

Reply to
Chuck

eliminate ((strcat "c:" vname))

Reply to
Patrick Hughes

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.

Reply to
Chuck

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.

Reply to
Patrick Hughes

PolyTech Forum website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.