Automatic Backups


Recommended Posts

I recently had a corrupted file, and even the back-up I created when DAQFactory brought up a warning window was corrupt.

 

Perhaps I can suggest a feature for a future release. Have a directory named "Short-term backups" and then, if Auto-Save if enabled, automatically save backup files there with a date-time suffix and the .bak extension added to avoid any file-searching confusion.  Then whenever DAQFactory exits normally, delete any files older than the 10 most recent.

 

For now, It would be nice to be able to save backups with a single click.  I prefer the current version of a file to not have a file name with a date on it.  When I create-backups, then I do like a version number or date.  My current approach in DAQFactory is to do a regular Save, and then a Save-as, and add the date-time.  But, then I have to re-open the prior save, to start with the plain file name again.

 

Is there any way to make the above a one-click operation?

 

-Joe

Link to comment
Share on other sites

  • 2 months later...

For that matter, may I suggest that a real life version control system like GIT could be used to a great effect? It would be awesome if git could be integrated into a single-click solution.

 

http://en.wikipedia.org/wiki/Git_%28software%29

 

Git seems a bit overwhelming when one has no previous experience with version control systems, but i promise it that over time it becomes the engineer's best friend.

Link to comment
Share on other sites

  • 2 weeks later...

You can use your own version control all you want.  We use subversion along with Tortoise SVN as the window's client for it.  Its pretty darn easy to use.

 

However, that said, we also like versioning our programs and save each version as a new file name.  Alas, I often forget to update the version number and hit File - Save instead of Save - As when I make a change, so I can see the need.  I'm not sure about auto-deleting though.

 

That all said, there is a built in system variable called:

 

system.appVersion

 

It starts at 1, and increments by 0.01 every time you save.  You can make it jump by specifying your own version number, and it will increment by 0.01 from there.  We could use that as a postfix on the file name when doing the backup.  I don't think I would put it in a special folder though.  I'd just save it in the same folder with the modified name.  I don't know about you, but I have many folders, one for each application / customer, and would prefer to have all the backups there as well.

 

Feedback?

Link to comment
Share on other sites

I suppose another alternative is to use a backup program that has a scheduler. Then schedule a backup of the directory where you save programs at what ever increment you want.  Though, it is normally the most recent few saves that you really want to go back to, since it was probably some recent change that caused the program to lock up or otherwise go bad.

 

-Joe

Link to comment
Share on other sites

If you are working with a single CTL file, the following batch file would accomplish what you want. It will save 10 copies in a directory named saveit. The most recent backup will be named save.ctl. The oldest save9.ctl. You could create a button that would shell out and execute this batch file automatically saving your CTL file in the saveit directory. Put the following code into a text file and save it to your DAQFactory directory as "saveit.bat"

 

@echo off
    if not exist saveit\save.ctl mkdir saveit
    cd saveit
    if exist save9.ctl del save9.ctl
    if exist save8.ctl rename save8.ctl save9.ctl
    if exist save7.ctl rename save7.ctl save8.ctl
    if exist save6.ctl rename save6.ctl save7.ctl
    if exist save5.ctl rename save5.ctl save6.ctl
    if exist save4.ctl rename save4.ctl save5.ctl
    if exist save3.ctl rename save3.ctl save4.ctl
    if exist save2.ctl rename save2.ctl save3.ctl
    if exist save1.ctl rename save1.ctl save2.ctl
    if exist save.ctl  rename save.ctl  save1.ctl
    copy ..\myproject.ctl save.ctl
    cd ..
:end
    echo.

 

Change "myproject" in the batch file to be the name of CTL file you are working with.

If you have multiple CTL files, change the copy command to use a zip type file compression utility.

 

With some modification to suit you particular needs it might get you close to what you are asking for. Hope it helps.

Link to comment
Share on other sites

I didn't find batch files in the DAQFactory help file, but do recall batch files back in the old DOS days, so I am assuming this is the type of batch file you have.  I just looked in my Windows 7 help screen for the word "Batch" and ".bat" but there were no hits.  Does Windows 7 even support DOS style batch files?

 

In regards to the button are are referring to; am I correct that this would be a special button you create on one of the pages of your user interface?  Or is it possible to add custom buttons to DAQFactory's own interface, like many Windows programs permit? E.g.  If I wanted to activate a batch program in MS Word, I would crate a macro, and then create and assign a button to it.

 

Thanks for the great idea about using a batch file.

 

-Joe

Link to comment
Share on other sites

The batch file Eric is talking about is just a text file.  It is run from the command prompt just like the old DOS days.  To run it you have to use the DAQFactory script "system.shellexecute()".  You can try just executing it directly, or you might have to tell shellExecute() to run cmd.exe and then have the batch file as a parameter (possibly with the /C option).

 

Since system.shellExecute() is a script, you can add a button to any page and put the code in the Quick Sequence for the button.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.