English

How To: Create a backup of an ArcView project

Summary

The following script creates a copy of the current .apr file and places it in the $HOME directory. When you save the project, this script will create a file with the same project name and a .bak extension instead of .apr. You can then manually change the .bak file extension to .apr and load it as an ArcView Project.

Procedure

  1. In your current ArcView project, open a New Script window.

    A. Activate the Project window.
    B. Click the Scripts icon.
    C. Click New.

  2. Use the Open System Script button
    [O-Image] Load System Script
    to load the Project.Save script into the script window.
  3. Copy the following code at the end of the Project.Save script. Rename the script window to Project.Save:

    Code:
    theProject = av.GetProject
    theProjName = theProject.GetFileName
    theprojStrng = theProjName.AsString
    theCount = theProjstrng.count
    thefnlCount = (theCount - 4)
    theNewName = theProjStrng.left(thefnlCount)
    theNewBak = theNewName ++ ".Bak"
    theNewBakFile = theNewBak.AsFileName

    '-- Makes a Bak file of current APR
    theFName = TextFile.Make( theNewBakFile, #FILE_PERM_WRITE )
    theAPR = TextFile.Make( theProjName, #FILE_PERM_READ )
    source = theAPR.Read( theAPR.GetSize )
    theFName.Write( source, theAPR.GetSize )
    theFName.Close

  4. Click the Compile
    [O-Image] Script compile button
    button.

    Note:
    When you save this project, it will automatically save a file with the .bak extension to the default working directory.