I have got it working by adding the delay befopre the renaming happens to allow for the pdf to be created but it is a bit hit and miss depending on the speed of the machine it is run on.
Any suggestions on a better way, I have tried to wait for the file to be recognised using various doslib commands but I think the file is there as soon as the pdfcreator starts to make it, but it is still open so the lisp just crashes... Sorry if this is a bit confusing (and long) for a friday afternoon but i think ive run out of ideas..
(defun c:pdf-rev ( / newfile tabname dname dname1 dpref pdfoldname pdfnewname )
(setq oldtile (getvar "tilemode"))
(setvar "tilemode" 0)
(command "plot" "y" "" "PDFcreator" "A3" "m" "l" "n" "e" "1:2" "c" "y" "a3.ctb" "y" "n" "n" "n" "n" "n" "y")
(dos_waitcursor T)
(blocksearch)
(setq tabname (getvar "ctab"))
(setq dname (getvar "dwgname"))
(setq dname1 (substr dname 1 (- (strlen dname) 4)))
(setq dpref (strcat "C:/My Documents/PLOTFILES/"))
(setq pfdoldname (strcat dpref dname1 " " tabname " (1)" ".pdf"))
(setq pdfnewname (strcat dpref dname1 "_" newfile ".pdf"))
(command "delay" 8000)
(dos_delete pdfnewname)
(dos_rename pfdoldname pdfnewname)
(dos_waitcursor)
Or am I way off here.
Bill
(dos_attrib [filespec [bits]])
Parameters
filespec
The desired file or files. filespec can contain wildcard characters ("*" and "?"). If filespec is not supplied, it is assumed to be *.*.
bits
A bit-coded integer identifying the desired file attributes to set. Specify more than one file attribute by adding the following bit values:
0
Normal
1
Read-only
2
Hidden
4
System
8
Archive
Returns
An association list containing the filenames and the attribute bits if successful.
nil on error.
Example
Command: (dos_attrib "c:\\program files\\autocad 2002\\*.dwg")
(("Drawing1.dwg" . 8) ("Drawing2.dwg" . 8))
-------- from the help file..
Bob