Author Topic: Auto Save File  (Read 2702 times)

0 Members and 1 Guest are viewing this topic.

GDF

  • Water Moccasin
  • Posts: 2055
Auto Save File
« 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?

Code: [Select]
;;; 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)
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

MP

  • Seagull
  • Posts: 17662
  • Have thousands of dwgs to process? Contact me.
Re: Auto Save File
« Reply #1 on: April 22, 2009, 04:37:20 PM »
Given that 1440.0 is a divisor I'm under the impression making it larger would reduce the interval between saves.
Engineering Technologist CAD Specialist Programmer Analyst
Design Drafting Document Control Automation.
cadanalyst@fastmail.com https://cadanalyst.slack.com http://linkedin.com/in/cadanalyst

GDF

  • Water Moccasin
  • Posts: 2055
Re: Auto Save File
« Reply #2 on: April 22, 2009, 04:42:11 PM »
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.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64