Backup autosave file... Bad idea?

Discussion in 'AutoCAD' started by Paul Turvill, Oct 2, 2004.

  1. Paul Turvill

    Paul Turvill Guest

    So how is this routine supposed to get called? If you're going to go to the
    trouble to call a routine to back up the AutoSave file, it seems to me it
    would be just as simple to use the QSAVE command.
    ___
     
    Paul Turvill, Oct 2, 2004
    #1
  2. Paul Turvill

    James Allen Guest

    Hi all,

    Here's what I've got, but I'm worried about unforeseen consequences. Does
    anyone see any problems with this? Of course, recommendations for
    improvement are always welcome as well.

    ;;; AutoSave makes a copy of AutoCAD's current autosave file.
    (defun AutoSave (arglst / date sfp file1 file2)
    (setq date (getvar "date")
    sfp (getvar "savefilepath")
    file1 (getvar "savefile")
    file2 (strcat sfp "\\AutoSave " (getvar "dwgname"))
    )
    (if (and (or (not ASV:TimeToSave) (>= date ASV:TimeToSave))
    file1
    )
    (progn
    (prompt "\nBacking up autosave file ... \n")
    (vl-file-delete file2)
    (vl-file-copy file1 file2)
    (setq ASV:TimeToSave (+ date (/ (getvar "savetime") 1440.0)))
    )
    )
    (princ)
    )
    ;;; EditorRxr is the reactor callback function called by the
    "vlr-Editor-reactor"
    (defun EditorRxr (calling-reactor commandInfo /)
    (vl-load-com)
    (AutoSave '(nil))
    (princ)
    )
    ;;; The Editor reactor
    (vlr-Editor-reactor
    nil
    (list
    ':)vlr-commandWillStart . EditorRxr)
    )
    )
     
    James Allen, Oct 2, 2004
    #2
  3. Paul Turvill

    James Allen Guest

    Judging from the responses so far, maybe I should be more specific (and I
    probably could have worded the subject line better...). This is intended to
    run automatically (hence the reactor) in the background and allow the
    "autosave" file to be retrieved if something happens to the primary working
    file. It basically alleviates the (IMHO) problem of AutoCAD deleting its
    own autosave file on any 'normal' exit. I'm sure this is what I want to do,
    I'm just concerned about possibile ramifications of my code and/or approach
    in terms of performance, stability, etc.

    As far as copying the autosave file rather than 'just' saving again, I
    figured the save has already been done by AutoCAD and a simple file copy
    would be more efficient. If I'm wrong on that, someone please let me know.
    Besides, I'm not sure how to save the current file to a different location
    (leaving the current file active in the same location) without interrupting
    the user. I've actually wanted to do that before for different purposes,
    but that's another topic.

    I appreciate your thoughts Paul and Dean.
     
    James Allen, Oct 2, 2004
    #3
  4. Paul Turvill

    Paul Turvill Guest

    OK, so set up your reactor to simply do a SAVEAS to a specific drive, rather
    than depending on AutoCAD's flaky AutoSave process.

    Honestly, in over 20 years with AutoCAD, we've had to depend on AutoSave
    fewer than half a dozen times, and none of those in at least the past five
    years. AutoSave is a poor substitute for good work habits.
    ___
     
    Paul Turvill, Oct 2, 2004
    #4
  5. Paul Turvill

    James Allen Guest

    Am I incorrect that a file copy is quicker / more efficient than a save? I
    am basing this only on working observation. It just seems like I have to
    wait longer for a save operation than a file copy operation on a given file.
    I am content to let my solution *follow* AutoCAD's. As far as I can tell,
    the built-in autosave works fine except for the file disappearing. I
    believe circumventing that disappearing act is all I need to do.
    I couldn't agree more. Do I want to depend on autosave? Absolutely not.
    But..., the next time a user loses their work by whatever means (happened
    again recently, hence my current focus), I believe it is in the company's,
    the user's, and my best interests if I have found a simple way to quickly
    get us back in business. That solution is what I think I have here. I only
    wish I had done this sooner...

    I appreciate everyone's input on this already, but am still hoping for some
    technical feedback regarding performance/stability. There are 3 reasons I
    went with the file copy as opposed to a save/as.

    1. I do not want to change the active file's location.
    2. I do not want to alter the currently saved primary file (i.e. saveas
    over it to restore the original location), in case the user has
    intentionally not saved yet.
    3. As mentioned at first, I thought it was more efficient anyway.

    Thank you all.

    James
     
    James Allen, Oct 4, 2004
    #5
  6. You don't want to do a SAVEAS, because that leaves you working in that new
    file that it makes, rather than leaving you in your original file. You want
    SAVE instead. And don't think you're doing this with AutoCAD's so-called
    "Save" menu & toolbar items -- the ones that say "Save" or have a disk icon
    actually do a QSAVE. The actual SAVE command can be invoked in a lisp
    routine or macro or whatever, or typed in, but I don't think you can do it
    from their standard menu items. Check out the difference in Help.

    Kent Cooper, AIA


    ...
     
    Kent Cooper, AIA, Oct 4, 2004
    #6
  7. Paul Turvill

    Dan Allen Guest

    Wow - I have a totally different experience with autosave. I use it all the
    time as we have flaky drawings that crash. My SAVETIME is five minutes to
    minimize loss of work. I never have an issue with the .SV$ files
    disappearing. The only bad luck is if a drawing currently being edited has
    become permanently corrupt resulting in all saved files including autosaves
    & bak's being unopenable. (pretty rare hasn't happened in a year).

    To make it easier to find the autosave folder, I use this in a menu:
    ID_ExploreTemp [Explore Temp Folder with AutoSave Files]^C^C^P(startapp
    (strcat "explorer.exe /e,"(getvar "tempprefix")))

    Dan
     
    Dan Allen, Oct 5, 2004
    #7
  8. Paul Turvill

    OLD-CADaver Guest

    AutoSAVE is protection only against catastrophic failures and is not a good substitute for good work habits. If AutoCAD exits the program properly the SV$ is deleted. If any of AutoCAD's SAVE features are implemented the SV$ is deleted. That is the proper function of AutoSAVE.
     
    OLD-CADaver, Oct 5, 2004
    #8
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.