mdbdesign 发表于 2022-7-6 11:07:06

Open file and run lisp - macro

Never did it before:
Need button macro that will open file (dwg) and execute one lisp command in it.
It is possible just something very simple?
Thank you in advance.

Lee Mac 发表于 2022-7-6 11:14:49

How about putting the LISP file in the ACADDOC.lsp to run when loaded, and click open

mdbdesign 发表于 2022-7-6 11:21:16

Lee I will need it only for one dwg. I don't need it to load with every start up. That is the problem. Start file execute lisp and that it for few weeks and start over again. It must be done in same way always but I think I or somebody will not remember it after time.

alanjt 发表于 2022-7-6 11:29:46

You could load a script from the button to open a specific file and execute commands.

alanjt 发表于 2022-7-6 11:36:26

Not exactly what you want, but in your program shortcut, you can add
and it will open autocad with that file.

mdbdesign 发表于 2022-7-6 11:38:21

Thing is: somebody with 0.0000001% knowledge of AutoCAD will use it most of the time to update dwg. Need it foul proof. just one click and done.

alanjt 发表于 2022-7-6 11:44:36

Sounds like a script is the answer or put it in the acaddoc file that if a filename matches the specific file, run the lisp on it.

mdbdesign 发表于 2022-7-6 11:54:10

Or just change
to 1% will work. It is possible.

MarcoW 发表于 2022-7-6 11:55:57

If you have made yourself a button, then add a macro in there like this:
 

^C^C^Pmylisp;
 
Of course "mylisp" is an example function in the lisp file itself.
Thats for the button...
 
Create and save the lisp in one of the autocad support file search paths. You can see where they are or add the folder where your lisp is stored: options>first tab>support file search paths>add>browse to your location.
 
Now in this same folder create a file called acaddoc.lsp. In this file you put 1 line:'
 

(autoload "FILENAME" '("mylisp" "mylispifIhad2namesforit")
 
Well all this should do what you need.
 
Much credit to Alanjt and others who have helped me a lot with this.

alanjt 发表于 2022-7-6 12:04:49

Load/AutoLoad Usage
页: [1] 2
查看完整版本: Open file and run lisp - macro