AfraLisp Blog

The AutoLisp/Visual Lisp/VBA Resource Website

AfraLisp Blog

Home Newsletter Utter Rubbish Coding Tips AutoCAD Tips Contact Downloads WAUN

Is it possible to get a program to select a file just plotted and have it
sent to a backup folder ?

And the answer is :

Copy and paste this coding into Notepad and save it as "EndPlot.lsp". You must only load this application. "Do not run it, as it contains reactors".
Open the drawing you want to plot, and then load the application : (load "endplot")
Plot your drawing. At the end of the plot the application will first Save the drawing to the current directory, and then SaveAs, to a directory called "c:/backup/". You can quite easily change the directory path to suit your backup directory.

;CODING STARTS HERE

(prompt " \nLoad Only....Do NOT Run...")

(vl-load-com)

;*******************************************************
(vlr-command-reactor

nil '((:vlr-commandEnded . endPlot)))

;*******************************************************
(defun endPlot (calling-reactor endcommandInfo /

thecommandend drgName newname)

(setq thecommandend (nth 0 endcommandInfo))

(if (= thecommandend "PLOT")

(progn

(setq acadDocument (vla-get-activedocument
(vlax-get-acad-object)))

(setq drgName (vla-get-name acadDocument))

(setq newname (strcat "c:\\backup\\" drgName))

(vla-save acadDocument)

(vla-saveas acadDocument newname)

);progn

);if

(princ)

);defun

;*********************************************************

(princ)

;CODING ENDS HERE

The AutoLisp/Visual Lisp/VBA Resource Website

Copyright © 1999-Perpetuity by AfraLisp

All rights reserved.
Information in this document is subject to change without notice.
Site created and maintained by Kenny Ramage

The AutoLisp/Visual Lisp/VBA Resource Website