TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: GDF on April 22, 2009, 04:11:49 PM
-
I would like to shorten the time limit that is set by this code for creating an auto save file.
Would I use a smaller or larger number to replace the 1440.0?
;;; AutoSave makes a copy of AutoCAD's current autosave file.
;;;http://discussion.autodesk.com/thread.jspa?messageID=4083449
(vl-load-com)
;;; Getvar using ActiveX
(defun MWE:GetVar (arglst)
(vlax-invoke ActiveDocument 'GetVariable arglst))
;;; AutoSave makes a copy of AutoCAD's current autosave file.
(defun MWE:AutoSave (rxrnm cmdinf / ActiveDocument date file1 file2)
(setq ActiveDocument
(vlax-get (vlax-get-acad-object) 'ActiveDocument)
date (MWE:GetVar "date")
file1 (findfile (MWE:GetVar "savefile")))
(if (and file1 ASV:TimeToSave (>= date ASV:TimeToSave))
(progn (setq file2 (strcat (MWE:GetVar "savefilepath")
"\\AutoSave "
(MWE:GetVar "dwgname")))
(prompt "\nBacking up autosave file ... \n")
(if (findfile file2)
(vl-file-delete file2))
(vl-file-copy file1 file2)
(setq ASV:TimeToSave nil)))
(if (not ASV:TimeToSave)
(setq ASV:TimeToSave (+ date (/ (MWE:GetVar "savetime") 1440.0))))
(princ))
;;; Load the AutoSave Reactor
(vlr-command-Reactor
"Command reactor"
'((:vlr-commandWillStart . MWE:AutoSave)))
(princ)
-
Given that 1440.0 is a divisor I'm under the impression making it larger would reduce the interval between saves.
-
Given that 1440.0 is a divisor I'm under the impression making it larger would reduce the interval between saves.
Thanks
I just wanted to be sure. This code works great and has saved me in the past.