can someone help me out with this one? trying to delete a file every time CAD is fired up and/or a new drawing is opened. i cannot make it work so far. planning to incorporate it into acaddoc lsp file.
(defun deletestupidfile()
(vl-load-com)
(setq myname (getvar "loginname"))
(if (= (getenv "PROCESSOR_ARCHITECTURE") "AMD64")
(progn
(vl-file-delete (strcat "C:\\Users\\" myname" \\AppData\\Roaming\\Autodesk\\C3D 2011\\enu\\Support\\test.xlsx"))
)
(progn
(vl-file-delete (strcat "C:\\Users\\" myname" \\AppData\\Roaming\\Autodesk\\C3D 2011\\enu\\Support\\test.xlsx"))
(princ)
)
)
)
thanks for the reply Jeff, i still cannot make it to work. if you do not mind, can you please take another peek:
(defun deletestupidfile(event parameter)
(vl-load-com)
(setq myname (getvar "loginname"))
(if (= (getenv "PROCESSOR_ARCHITECTURE") "AMD64")
(progn
(vl-file-delete (strcat "C:\\Users\\" myname "\\AppData\\Roaming\\Autodesk\\C3D 2011\\enu\\Support\\test.xlsx"))
)
(progn
(vl-file-delete (strcat "C:\\Documents and Settings\\" myname "\\Application Data\\Roaming\\Autodesk\\C3D 2011\\enu\
\Support\\test.xlsx"))
(princ)
)
)
)
it should run automatically (added to acaddocXXXX.lsp), every time i open a drawing or fire up CAD, and delete that test.xlsx file. does not seem to do it currently.
Looking at the required arguments for the function, are you intending to run this as a callback function of a reactor? Otherwise, you will need to supply the function with the arguments for 'event' and 'parameter'.
You should only modify either the ACADDOC.lsp or ACAD.lsp (create these if they don't exist in the support path), the other files are reserved for AutoCAD.
Read this:
http://docs.autodesk.com/ACD/2011/ENU/filesACG/WS73099cc142f4875513fb5cd10c4aa30d6b-7f72.htm
Perhaps consider the following function:
(defun deletestupidfile nil (if (vl-string-search "64" (getenv 'PROCESSOR_ARCHITECTURE)) (vl-file-delete (strcat "C:\\Users\\" (getvar 'LOGINNAME) "\\AppData\\Roaming\\Autodesk\\C3D 2011\\enu\\Support\\test.xlsx")) (vl-file-delete (strcat "C:\\Documents and Settings\\" (getvar 'LOGINNAME) "\\Application Data\\Roaming\\Autodesk\\C3D 2011\\enu\\Support\\test.xlsx")) ) (princ) ) (vl-load-com) (deletestupidfile)
Copy the above into your ACADDOC.lsp.
still cannot make it work! this is now driving me nuts. i copied it to acaddoc lsp, the file test.xlsx does nto get deleted! now what am i doing wrong??
*Edited:
nevermind, i noticed shortly after it was bailing as the PROCESSOR_ARCHITECTURE did not have quotes ("") around it. thanks for the the help, much appreciate.
@youngEIT wrote:
*Edited:
nevermind, i noticed shortly after it was bailing as the PROCESSOR_ARCHITECTURE did not have quotes ("") around it.
Not sure how I missed that!