@djurk_haas wrote:
....
I tried your option but it keeps given me the error bad argument type: FILE nil
Any other ideas?
The message means that at some place where it's expecting to be given a FILE to work with, it's not being given anything. That could only mean [I think] that one of these lines is failing:
(setq fn (strcat (getvar 'DWGPREFIX) (vl-string-subst "txt" "dwg" (getvar 'DWGNAME))))
(if (/= fn nil)
(progn
(setq fh (open fn "w"))
I didn't get that error message when I used the (strcat) corrections suggested in Post 5, though I didn't work through the entire operation -- just enough of it to get to where the error message would be triggered if there was a failure.
If the first line is failing, that would mean 'fn' would be nil, and it would not set 'fh', but it would also never get to the point of trying use what's in the 'fh' variable and trigger that error. So it's hard to imagine that the first line is what's failing. That should produce a valid result in any drawing, anyway, which should mean that 'fn' would not be nil, so the routine would get to the attempt to set the 'fh' variable, and that therefore looks like it should be the problem -- the setting of 'fh' must be returning nil, in order for that error message to occur from later attempts to use the file that's supposed to be in the 'fh' variable.
Is the current drawing's folder location restricted in some way that would mean it will not be permitted to open a file in it? That's about the only thing I can think of that might cause this problem.
Kent Cooper, AIA