I am trying to setup code that will do incremental autosaves about every 5 minutes, right now I have turned off the reactor portion because it keeps saying too many arguments, not sure why, maybe someone can help me figure that out as well, but where the aSave function fails is at vl-file-copy, I have even tried typing in the full paths and they still fail, any ideas why? I just get a nil error, not exactly helpful.
;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")
)
)
)