Delete Autosave

Delete Autosave

Anonymous
Not applicable
65,103 Views
118 Replies
Message 1 of 119

Delete Autosave

Anonymous
Not applicable
Apparently AutoCAD will delete the autosave if it feels it was shut down
correctly. Well mine crashed yesterday and the autosaves were all deleted
so I ended up losing all my work since the previous qsave. I would like to
know if there is a variable for this or a way we could change it to just
never delete? I would be glad to manually purge the directory, but I never
want what happened yesterday to happen again. It makes autosave rather
pointless in my book.

--
Dr. After
0 Likes
65,104 Views
118 Replies
Replies (118)
Message 81 of 119

Anonymous
Not applicable
Okay... I fixed the early code.... for something like this.... still the
[APPEND argument] from vl-file-copy is growing the file..... for now I have
no idea why??

Please, test this with more than one drawing open and see if works....

LE

(defun copy_sv$ (reactor params / files file)
(if
(and (setq files
(vl-directory-files (getvar "SAVEFILEPATH") "*.SV$"))
(setq file
(vl-some
(function
(lambda (dwg)
(if
(wcmatch
dwg
(strcat "*"
(substr (getvar "DWGNAME") 1 12)
"*"))
dwg)))
files)))
(progn
;;;;;;;;; (vl-file-delete
;;;;;;;;; (strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME")))
(vl-file-copy
(strcat (getvar "SAVEFILEPATH") "\\" file)
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME")) t)
)))

(if (not dwg_reactor)
(setq dwg_reactor
(vlr-dwg-reactor nil '((:vlr-beginsave . copy_sv$)))))

(princ)
0 Likes
Message 82 of 119

Anonymous
Not applicable
*Luis Esquivel* typed them thar words:

| while I'm trying to fix this, please the code is open, anyone can do
| the adjustments necessary on the mean time....

I am not too up and up on reactors and such... but I don't mind giving it a
try.

| I made mistakes too..... 🙂


hehe...

| For example no one noticed that there is an error if we have the MDI
| stuff like more than two drawings at the time open... the code will
| fail.... or actually it will overwrite any other "*.SV$" to the
| current drawing that we have focus.....

I hadn't tried it with more then one drawing open yet... That could be a
small problem.

--
Dr. After
0 Likes
Message 83 of 119

Anonymous
Not applicable
And as I said.... the code is open..... anyone can jump on it....

I did something similar of what Jeff is commenting.... but did not
finished....

Here is, and please make your own adjustments or corrections, it is possible
to do in there a list of commands we want it to avoid or not.... I don't
know.... I have to go back to work... if not I will be in trouble.... and
get fired for real....

I'll be watching...
Luis.

;|
(vl-load-com)

(if (not (vl-file-directory-p "C:\\AUTOSAVE\\"))
(vl-mkdir "C:\\AUTOSAVE\\"))

(if (not aobj)
(setq aobj (vlax-get-acad-object)))

(if (not dwg)
(setq dwg (vla-get-activedocument aobj)))

(defun auto_save (reactor params)
;;; (print (getvar "dbmod"))
;;; (print (getvar "cmdnames"))
(if (and (/= (getvar "dbmod") 0)
(not (wcmatch (getvar "cmdnames") "U,UNDO,REDO,OOPS")))
(repeat 2 (vla-save dwg))))

(defun save_dwg (reactor params)

(if (findfile
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME")))
(vl-file-delete
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME"))))

(vl-file-copy
(strcat (getvar "DWGPREFIX") (getvar "DWGNAME"))
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME"))))

(if (not editor_reactor)
(setq editor_reactor
(vlr-editor-reactor
nil
'((:vlr-commandended . auto_save)
(:vlr-beginsave . save_dwg)))))

;;;(vlr-remove editor_reactor) (setq editor_reactor nil)

(princ)
|;
0 Likes
Message 84 of 119

Anonymous
Not applicable
I have so say something..... hehe 🙂


"Jeff Mishler" wrote in message
news:4863935@discussion.autodesk.com...
"Luis Esquivel" wrote in message
news:4863946@discussion.autodesk.com...

I made mistakes too..... 🙂


NO!!!! Say it ain't so!

;-)
0 Likes
Message 85 of 119

Anonymous
Not applicable
I have actually posted this in the past, but I can't seem to find the
thread(s) in this or the vba forums. I do know it is in this thread:
http://www.theswamp.org/phpBB2/viewtopic.php?t=4735

Jeff

"Dr. After" wrote in message
news:4863919@discussion.autodesk.com...
*Jeff Mishler* typed them thar words:

| I created my own VBA app that performs a
| save for me after every 25 commands have been issued (exclusive of
| zooms, pans and undo's) I never worried about the autosave issue.

ummm.... care to share that with the rest of the group? You know the
rules... If you bring enough for yourself, you better bring enough for
everyone.
;-)

|
0 Likes
Message 86 of 119

Anonymous
Not applicable
With VBA and the "endsave" event maybe you could simply change the sv$ file
ext. to dwg on the fly. Something like the snip below (Acad 2004).

You'd have to clean out the dir often or add some code to delete older
versions. Perhaps in the close event.

Probably other unforeseen ramifications as well.

Private Sub AcadDocument_EndSave(ByVal FileName As String)

On Error Resume Next

If Right(FileName, 3) = "sv$" Then
Name FileName As Left(FileName, (Len(FileName) - 3)) & "dwg"
'Possibly store new filename (from line above) and delete on next pass
End If

On Error GoTo 0

End Sub



"Dr. After" wrote in message
news:4861667@discussion.autodesk.com...
Apparently AutoCAD will delete the autosave if it feels it was shut down
correctly. Well mine crashed yesterday and the autosaves were all deleted
so I ended up losing all my work since the previous qsave. I would like to
know if there is a variable for this or a way we could change it to just
never delete? I would be glad to manually purge the directory, but I never
want what happened yesterday to happen again. It makes autosave rather
pointless in my book.

--
Dr. After
0 Likes
Message 87 of 119

Anonymous
Not applicable
*Luis Esquivel* typed them thar words:

| Please, test this with more than one drawing open and see if works....

It doesn't seem to work, though AutoCAD's isn't near as punctual with more
then one drawing open.

--
Dr. After
0 Likes
Message 88 of 119

Anonymous
Not applicable
"Dr. After" wrote in message
news:4863805@discussion.autodesk.com...

You are a smart fellow with many years of cadding... you got any solutions
to this?

The "smart fellow" is debatable. Other than "save and save often" there is
no solution AFTER the failure.
It's about the same as someone driving too fast & careless crashing their
car. If they learn to slow down and practice safe driving they may not
crash. A bad crash will leave the car unrepairable.


Murph
0 Likes
Message 89 of 119

Anonymous
Not applicable
*Luis Esquivel* typed them thar words:

| And as I said.... the code is open..... anyone can jump on it....

I am about to head out the door for the day... On to my IT job. I will try
and toy with it some tomorrow, though. Thansk!

| I did something similar of what Jeff is commenting.... but did not
| finished....

yup... your fired!
:-9

| Here is, and please make your own adjustments or corrections, it is
| possible to do in there a list of commands we want it to avoid or
| not.... I don't know.... I have to go back to work... if not I will
| be in trouble.... and get fired for real....

No problem. Like I said I will try and toy with it tomorrow and see what
happens.

--
Dr. After
0 Likes
Message 90 of 119

Anonymous
Not applicable
*Murph* typed them thar words:

| The "smart fellow" is debatable. Other than "save and save often"
| there is no solution AFTER the failure.
| It's about the same as someone driving too fast & careless crashing
| their car. If they learn to slow down and practice safe driving they
| may not crash. A bad crash will leave the car unrepairable.

granted, but if we had the ability to impliment a program that prevent the
car from crashing...
;-)

All I'm saying is there are ways of assuring proper backups and it looks
like a couple in here already have that available and one who did a great
job of getting one started.

Have a good one Murph.

--
Dr. After
0 Likes
Message 91 of 119

Anonymous
Not applicable
> Where is the problem and how do I fix it?

I've offered several causes and solutions for your problem, however your refusal to accept any part of the blame for the problem has blinded you to the worth of what has been offered thus far.


> AutoCAD crashes and no autosave, backup, or recoverable file is available.

Assuming you've already checked your hardware to eliminate failing drives and such, the proper use of SAVE and QSAVE solves the problem.


> Qsave will be used as always, but mistakes happen by users as they are not perfect and will sometimes not be used.

Then you can expect lost data. If autoCAD crashes, and the SAVETIME has not been exceeded, there will be no possible retrieval of the data.


> but do realize I have done all ruling out on my end of user fault in this case and have notified you of that in the very beginning.

Therein lies the problem, you've already "ruled out" your possible solutions. Now you can do the run-around-two-step with some lisp function that does only what you should be regularly doing, that is saving your file. But if you start by ruling out your solutions, it leaves you with little choice.
0 Likes
Message 92 of 119

Anonymous
Not applicable
> Why are you being so rude!?

Rude? I offer you solutions, you claim that's not the problem and tell me to go away, then call me rude.


> Do you treat people like this face to face?

People like you, I do.


> Please tell me how the user caused this problem.

He didn't bloody save his work, that's how. I mean how frelling hard is it to hit CTRL+S.

Apparently your organization has failed to provide the hardware to keep AutoCAD from crashing, as evidenced by your comments about several $SV and BAK files still in the Temp dir. KNOWING that means the user willfully refused to use the tools that would insure saved data, IE SAVE and/or QSAVE, but instead relied on a feature with which he was unfamiliar. That feature ran as it was programmed to run, unless the user has a version of AutoCAD different from every other version, it just didn't run as the user expected it to run. The result is lost data.
0 Likes
Message 93 of 119

Anonymous
Not applicable
"Dr. After" wrote in message news:4863765@discussion.autodesk.com...

AutoCAD crashes and no autosave, backup, or recoverable file is available.
How do we prevent that from happening in the future?
Qsave will be used as always, but mistakes happen by users as they are not
perfect and will sometimes not be used. We need a preventative for this
mistake. Where is your solution? That is all this thread is about, a
solution for that scenario.

---------------------------------

Get over it already.

You're driving a car down the street and hit another car because you forgot to step on the brake.
How do you fix this?
You remember to step on the brake next time.
But "Dr After" says "mistakes happen", and we might forget to step on the brake again sometime.
Guess what - you are exactly right - mistakes happen, that's why they are called mistakes.

Forget to step on the brake -and- forget to QSAVE

It's going to happen. You are going to lose data. What you are asking for is a CAD program that guarantees you will not lose data. Forget it.

Get over the fact that you are being hassled for not QSAVING for over 3 hours.

EOM
0 Likes
Message 94 of 119

Anonymous
Not applicable
> That is what baffled me the most. I had everything set up to create backup files and do autosave every 5 minutes, but here was no BAK or SV$ files for my most recent opening time. The last good backup was prior to the last good save over 5 hours before.

Where was the lates DWG file and how old was it? What were the settings for SAVEFILEPATH and SAVEILE?
0 Likes
Message 95 of 119

Anonymous
Not applicable
Here is my later approach, again anyone using this, please make sure to do
several tests.

;; 10:07 AM 6/1/2005 LE
;; 12:45 AM 6/2/05 LE
;; 3:06 PM 6/2/05 LE

(vl-load-com)

(if (not (vl-file-directory-p "C:\\AUTOSAVE\\"))
(vl-mkdir "C:\\AUTOSAVE\\"))

;; this appears to work on an MDI system
;; open more than one drawing(s) and load the
;; reactor on each of them, to test this
(defun copy_sv$ (reactor params / files file)
(if
(and (setq files
(vl-directory-files (getvar "SAVEFILEPATH") "*.SV$"))
(setq file
(vl-some
(function
(lambda (dwg)
(if
(wcmatch
dwg
;; here we need to find a much viable system
;; in order to return our desired drawing,
;; since autosave files will use XXXXXX1_11_11.SV$
;; or something like that
;;
;; do your own changes here
(strcat "*"
(substr (getvar "DWGNAME") 1 9)
"*"))
dwg)))
files)))
(progn

;; make a copy of SV$ file into the c:\\autosave folder
;; as a drawing extension with the OUT_ prefix
(vl-file-copy
(strcat (getvar "SAVEFILEPATH") "\\" file)
(strcat "C:\\AUTOSAVE\\" "OUT_" (getvar "DWGNAME")))

;; delete previous BAK_ file
(vl-file-delete
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME")))

;; rename the new OUT_ file with the BAK_ prefix
(vl-file-rename
(strcat "C:\\AUTOSAVE\\" "OUT_" (getvar "DWGNAME"))
(strcat "C:\\AUTOSAVE\\" "BAK_" (getvar "DWGNAME")))

;; delete OUT_ file
(vl-file-delete
(strcat "C:\\AUTOSAVE\\" "OUT_" (getvar "DWGNAME"))))))

(if (not dwg_reactor)
(setq dwg_reactor
(vlr-dwg-reactor nil '((:vlr-beginsave . copy_sv$)))))

(princ)
0 Likes
Message 96 of 119

Anonymous
Not applicable
>>later


That should be....

latest....
0 Likes
Message 97 of 119

Anonymous
Not applicable
*OLD-CADaver* typed them thar words:

| The result is lost data.

exactly. So how do we fix that? Fire the guy? Kick him in the head?
Would that actually prevent him from making a future mistake?

--
Dr. After
0 Likes
Message 98 of 119

Anonymous
Not applicable
*OLD-CADaver* typed them thar words:

|| Where is the problem and how do I fix it?
|
| I've offered several causes and solutions for your problem, however
| your refusal to accept any part of the blame for the problem has
| blinded you to the worth of what has been offered thus far.

What is your solution? To make a person never make a mistake ever again? I
would like to know how to do that!

|| AutoCAD crashes and no autosave, backup, or recoverable file is
|| available.
|
| Assuming you've already checked your hardware to eliminate failing
| drives and such, the proper use of SAVE and QSAVE solves the
| problem.

So how do I get the user to do that 100% of the time no mater what the
circumstances?

|| Qsave will be used as always, but mistakes happen by users as they
|| are not perfect and will sometimes not be used.
|
| Then you can expect lost data. If autoCAD crashes, and the SAVETIME
| has not been exceeded, there will be no possible retrieval of the
| data.


What if AutoCAD crashes and the savetime was well exceeded? Where is my
possibility of retrieving data? It isn't where it should have been? That
is my whole point! An abnormal crash occured and much time was lost due to
that. Other then making sure the use utalizes qsave 100% of the time, how
else could we prevent a lose here? <--- That is my question from the get
go.

|| but do realize I have done all ruling out on my end of user fault in
|| this case and have notified you of that in the very beginning.
|
| Therein lies the problem, you've already "ruled out" your possible
| solutions. Now you can do the run-around-two-step with some lisp
| function that does only what you should be regularly doing, that is
| saving your file. But if you start by ruling out your solutions, it
| leaves you with little choice.

Ok. I would like to put all the blame on the fool who forgot to save. How
do I prevent human error in the future? Isn't that what you are telling me
I should "fix"? Then give me a solution to it. I can tell ther user to
always use qsave but we all know words do not control another human being.
I could fire the guy, but then I have to replace them with someone green.
HOW DO I STOP HUMAN ERROR? ...concidering that is your solution

--
Dr. After
0 Likes
Message 99 of 119

Anonymous
Not applicable
*R.K. McSwain* typed them thar words:

| It's going to happen. You are going to lose data. What you are asking
| for is a CAD program that guarantees you will not lose data.

That is correct. And I'm going to get it and actually already have gotten
two programs that handle this situation. So when it does happen again, the
time lost wont be there and our CAD environment will be that much more
efficient and safe. You act like I'm asking for the impossible here.
Sticking with your guns and only accepting things for the way they are is
what leaves many people left behind in this new tech age. Being able to
adapt your programs to suit your specific needs is what gives people the
edge. I guess we know where you and the dead guy stand...

| Get over the fact that you are being hassled for not QSAVING for over
| 3 hours.

Sorry, but I didn't come here to get hassled, I came here for support. They
don't call this place a hassle group...

--
Dr. After
0 Likes
Message 100 of 119

Anonymous
Not applicable
*OLD-CADaver* typed them thar words:

| Where was the lates DWG file and how old was it? What were the
| settings for SAVEFILEPATH and SAVEILE?

the latest DWG was in the saved directory which was from about noon. The
last SV$ file was form about 9am. SAVEFILEPATH was still directed to the
default "Temp" directory. The SAVEFILE was just the name of the file right?
Or did you mean SAFETIME? If that's the case it was set to 5.

--
Dr. After
0 Likes