English

How To: Automatically create a backup of the ArcView project file

Summary

You can modify the Project.Open script to create an automatic backup of a project file each time the project opens successfully.

Procedure

  1. Open a new script window.
  2. Click the Load System Script button.
  3. Choose Project.Open from the list of system scripts on the Script Manager and click OK.
  4. Paste the following code snippet below the line "theFName=FileDialog.Show..." of the script.
    Code:
    strFullPath = theFName.GetFullName
    strBakPath = strFullPath.Substitute(".apr",".bak")
    File.Copy(strFullPath.AsFileName,strBakPath.AsFileName)
    
  5. Rename the script to Project.Open.Custom
     
    A. Select Properties from the Script menu.
    B. Type in a new name in the Name field.
    C. Click OK.
  6. Assign the Project.Open.Custom script to the Open Project control on the File menu of the Project GUI.
     
    A. Compile the script
    B. Switch to the Project window
    C. Select Customize from the Project Menu
    D. On the Customize dialog switch the Type dropdown to Project
    E. Switch the Category dropdown to Menu
    F. Double-lick the Click property at the top of the Customize dialog
    H. Select the script in the Script Manager and click OK
    I. Close the Customize dialog box.

    For more information refer to the Customize (dialog box) document in ArcView Help.
  7. Select Embed Script from the Script menu.
  8. Add these changes to the user default project.
     
    A. Switch to the Project window
    B. Select Customize from the Project Menu
    C. Click Make Default on the Customize dialog box
    D. Close the Customize dialog box
    Note:
    The Make Default button is not available if any extension are turned on. To activate this button turn off all extensions.
    Note:
    This creates a Default.apr file in the user's HOME directory. Any customizations added to the user's default project will be reflected in each new session of ArcView. For additional information regarding the HOME directory see the Related Information section below. 
    Note:
    To make customizations permanent for all users, add these changes to the system default project.
    A. Open a new Script window and enter the following:
    Code:
    av.GetProject.MakeSysDefault("c:\default.apr".AsFileName, FALSE)
    B. Close ArcView
    C. Rename "$AVHOME\ETC\default.apr" to "$AVHOME\ETC\default.bak"
    D. Copy the new default.apr file from the C:\ directory into the $AVHOME\ETC directory
     

Related Information