;Code loosely based from several pieces of code at:
;http://www.theswamp.org/index.php?topic=4735.15
(vl-load-com)
(setq minutes 5
DWGFolder (strcat (getvar "DWGPREFIX") "AutoSave\\")
DWGFile (getvar "DWGNAME")
MainFile (strcat DWGFolder DWGFile)
IncCount 0
)
(if (not
(vl-file-directory-p DWGFolder))
(vl-mkdir (strcat DWGFolder))
)
;test
;(if (not rxnAutoSave)
;(setq rxnAutoSave (vlr-editor-reactor nil '((:vlr-commandended . aSave))))
;)
(defun c:aSave (/ AutoName)
(if (= D1 nil)
(setq D1 (getvar "DATE"))
)
(if (> (* (- (getvar "DATE") D1) 1440.0) minutes)
(progn
(princ (strcat "\nAutoSaving To: " DWGFolder))
(princ "\nPlease wait .... ")
(setq IncCount (+ IncCount 1))
(if (> IncCount 10)
(setq IncCount 1)
)
(setq AutoName (strcat DWGFolder (rtos 0 2 IncCount) " - " DWGFile))
(if (findfile AutoName)
(vl-file-delete AutoName)
)
(vl-file-copy MainFile AutoName)
(princ "\nAutoSave is now complete.")
)
(progn
(princ "\nNot time yet")
)
)
)
Why not use the inbuilt there is more than just time in the autosave function do a google. Stuff like percent save.Because I need historic copies, for example someone is working on a drawing, saves and closes it, but realized they need one from 15 minutes before the file was saved.
The MainFile does not point to your DWG. You have added "AutoSave\\" to the path.Duh, I knew I was overlooking something simple, thank you.