Lisp error but file exists

Lisp error but file exists

cool.stuff
Collaborator Collaborator
2,761 Views
8 Replies
Message 1 of 9

Lisp error but file exists

cool.stuff
Collaborator
Collaborator

Hi!

I want to run a lisp on multiple files. To do that, I've found in forum two files, whose author is Jeffery P Sanders, one is "BATCHLISP.lsp" and the other is "SelectFiles.lsp".


When I run the "BATCHLISP.lsp", ACAD returns the following message:

; error: LOAD failed: "selectfiles"

 

The lisp files are attached.

 

Can someone help me please?

 

I dont know LISP Programming and I really need this because I got about 200 files to run some tasks..

 

Many thanks in advance

0 Likes
Accepted solutions (2)
2,762 Views
8 Replies
  • Lisp
Replies (8)
Message 2 of 9

xuantientutungXUK6E
Advocate
Advocate
Accepted solution

go to option and add "selectfiles" in trusted location.

then it will run.

Message 3 of 9

cool.stuff
Collaborator
Collaborator

Many thanks for your answer but it did not work or I did something wrong.

 

I typed "securityoptions" and add my folder to trusted locations.

Again, I got the same error.

 

Can you explain what I did wrong please?

 

Many thanks!

0 Likes
Message 4 of 9

cool.stuff
Collaborator
Collaborator

I did what you said:

 

OP-->Files-->Trusted Locations

 

and I've added the files path with '\...' in the end to consider all subfolders.

 

But it did not work either..

 

Can you help me please?

 

Thanks

0 Likes
Message 5 of 9

cadffm
Consultant
Consultant
Accepted solution

These pathes are only to say "trusted location", but you also have to make sure that AutoCAD can find the files!

Add the folder also as Searchpath for Supportfiles! (First node in Options/Files/)

 

The BatchLisp tries to load "SelectFiles" (.vlx/.fas or .lsp), but AutoCAD can not find a file with this name, that's the current problem.

Sebastian

Message 6 of 9

xuantientutungXUK6E
Advocate
Advocate

i run the lisp and here is a way to run it.

Firstly, you add  "selectfiles" in support file search path

Secondly, lisp will run and get errors cause it can not open file "batch.scr" . File "batch.scr" created by lisp.

                SO  you need to add file "batch.scr" in support file search path.

 

 

0 Likes
Message 7 of 9

roland.r71
Collaborator
Collaborator

I'm currently not able to spend time on checking anything out, let alone correct errors and such, but...

 

I did write my own 'program' to do just that (without a batch). It requires DOSlib though.

 

Check it out if you wish:

https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/need-help-testing-and-improving-my-l...

0 Likes
Message 8 of 9

xuantientutungXUK6E
Advocate
Advocate

i have run a lisp through all of drawing, about 2000 dwgs.

and my solution is more simple.

you only need put those code lisp in 

(defun s::startup ()

xxxxxxxxxxxxxxxxxxxxxxxxxx


(vl-cmdf "qsave")
(vl-cmdf "CLOSE" "Y")

)

autocad will run whenever you open a drawing and close automated.

if you dont want it close. you erase (vl-cmdf "CLOSE" "Y").

 

0 Likes
Message 9 of 9

roland.r71
Collaborator
Collaborator

Hmmm...

Well there are many ways that lead to Rome, but I'm not sure this is the right/easiest way.

It sounds/looks like you opened 2000 dwg's by hand or something. just the code is run automatically.

 

A real easy way:

(defun C:MF (/ filelist file) 
	; this function is my Proof of Concept (Roland.R71)
	; for running lisp on multiple drawings 
	; (sequential, without a batch)

	; for this you need:
	; - A list of files to process
	; - Some lisp code (or file) you wish to run on each drawing

	; create list with filenames. For this example a hardcoded
	; list is used, to show what the list should look like.
	(setq filelist 
	(list 	"C:/Lisp/TestDWG/Test_LayoutSET1.dwg" 
		"C:/Lisp/TestDWG/Test_LayoutSET2.dwg" 
		"C:/Lisp/TestDWG/Test_LayoutSET3.dwg" 
		)
	)

	; the next part is an example to select a directory and read
	; all files into a list, like the above.
	; NOTE: Either use this OR the hardcoded method, not both.
	; First we set the directory to read
;	(setq dwgdir "c:/lisp/testDWG")

	; ...but of course you don't want that directory to be hardcoded...
	; sadly basic autolisp has no function to let the user select
	; (just) a directory.
	; If you have DOSlib, it suddenly becomes easy:
; 	(setq dwgdir (DOS_GETDIR "Select directory:" "c:/lisp/testDWG"))

	; This will retrieve all (and only: thats what the 1 is for)
	; the filenames from set directory.
;	(setq filelist (vl-directory-files dwgdir "*.dwg" 1))

	; activate single document mode (required for sequential
	; processing, using a script or lisp)
	(setvar "SDI" 1)

	; Turn off the (re)intialisation of lisp with each drawing.
	; Meaning: lisp functions will stay loaded.
	(setvar "LISPINIT" 0)

	; for each file in the list
	(foreach file filelist
		; Open and process it.
		(command "_.fileopen" file) 	; open it.
		; --- Insert code to run here, or load/execute another lisp
		(command "Zoom" "e") 	; a simple zoom for the example
		; --- end of code to run on each file
		(command "Qsave") 		; save it.
	)	
)

 

0 Likes