/3.0 (ODB.1 FirstRootClassName: "Project" Roots: 2 Version: 30 ) (Project.2 Name: "chgdir.apr" CreationDate: "Friday, October 03, 1997 03:47:49" GUIName: "Project" Win: 3 CSMgr: 4 VisGUIWidth: 70 Doc: 5 Buttons: 8 Buttons: 9 Buttons: 10 Scripts: 11 WorkDir: 770 WinX: 10 WinY: 2 WinW: 625 WinH: 455 StartUp: "ChangeProjectDirectory" SerialNumber: "709891118406" SelColor: 771 GUINames: 772 GUINames: 773 GUINames: 774 GUINames: 775 GUINames: 776 GUINames: 777 GUINames: 778 ) (DocWin.3 Owner: 2 Open: 1 X: -4 Y: -4 W: 627 H: 350 ) (CSMgr.4 ) (SEd.5 Name: "ChangeProjectDirectory" CreationDate: "Friday, October 03, 1997 03:48:02" GUIName: "Script" Win: 6 CSMgr: 7 Source: "' @(#)replstr.ave 1.10 3/19/95 13:53:24\n' Name: ReplaceString\n'\n' Headline: Searches for and replaces specified string in a text file.\n' \n' Self: \n'\n' Returns:\n'\n' Description: Searches for the specified string in the file and replaces \n' it with another string. Can be used to change UNIX, DOS or Macintosh\n' pathname specifications found in project (*.apr) files for use on other \n' platforms. May also be use to replace paths with system environment \n' variables (e.g. $DATA_HOME). \n'\n' Topics: Utilities, Co nversion, Projects \n'\n' Search Keys: Strings, Strings - substitution, LineFile, Files, \n' Project files (*.apr), Projects - pathnames, Substitution, Projects\n'\n' Requires:\n'\n' History:\n'-ESRI - ArcView 2.0\n'-ESRI - ArcView 2.1 updated for use of counter and stop button.\n'\nInfoMsg = \"This automated ArcView project allows you to change the drive and/or directory pathnames in an existing ArcView\"\nInfoMsg = InfoMsg ++ \"project (for example, if you move an existing ArcView project to another drive or directory). \"\nInfoMsg = InfoMsg ++ \"IMPORTANT NOTE: When specifying directories, use FORWARD slashes rather than BACK slashes.\"\nInfoMsg = InfoMsg ++ \"For example: After moving a project file called test.apr from e:\\water1\\wtrsheds to c:\\movedto, you would need to\"\nInfoMsg = InfoMsg ++ \"change all pathnames in test.apr by specifying e:/water1/wtrsheds as the string to\"\nInfoMsg = InfoMsg ++ \"change and c:/movedto as the replacement string.\"\nMsgBox.Report(InfoMsg,\"Updating Drive and/or Directory Pathnames\")\n \n' Get file t o change...\n'\nfileNameIn = FileDialog.Show(\"*.*\", \"File (*.*)\", \"Select File to Change\")\nif ( fileNameIn = nil ) then\n exit\nend\n \n' Create new default output name and get output file...\n'\ntempName = fileNameIn.GetBaseName.AsTokens(\".\").Get(0)\ntempExt = fileNameIn.GetExtension\ntempDir = fileNameIn.ReturnDir.AsString\ndefName = FN.Make(tempDir).MakeTmp(tempName,tempExt) \nfileNameOut = FileDialog.Put(defName, \"*.\"+tempExt, \"Save Changed File As\")\nif (fileNameOut = nil) then\n exit\nend\n\n' So licit for search/replace strings...\n'\nsearchString = MsgBox.Input(\"Enter string to change:\",\"Replace String\",\"\")\nif (searchString = nil) then\n exit\nend\n\nreplaceString = MsgBox.Input(\"Enter string to substitute:\",\"Replace String\",\"\")\nif (replaceString = nil) then\n exit\nend\n \n' Perform substitutions...\n' Output file is opened CLEARMODIFY since the user may have chosen to\n' overwrite the original file.\n'\nfileIn = LineFile.Make( fileNameIn, #FILE_PERM_READ )\nfileOut = LineFile.Make( fileNameOut, #FILE_PERM_CL EARMODIFY )\n\nnumChanges = 0\ncounter = 0\ntotal = fileIn.GetSize\ndone = false\n\nav.ShowStopButton\nav.ShowMsg(\"Searching...\")\n\nwhile (done.not)\n counter = counter + 1\n proceed = av.SetStatus( (counter / total) * 100 ) \n if (proceed.Not) then\n av.ClearStatus\n av.ShowMsg(\"Stopped\")\n exit\n end\n\n theString = fileIn.ReadElt\n if ( theString <> nil ) then\n if ( theString.Contains( searchString ) ) then\n numChanges = numChanges + 1\n newString = theString.Substitute( searchS tring, replaceString )\n else\n newString = theString \n end\n fileOut.WriteElt( newString )\n else\n done = true\n end\nend\n\nav.ClearStatus\n \n' Close and report results...\n'\nfileIn.Close\nfileOut.Close\nMsgBox.Info(\"File:\"++fileNameOut.AsString++\"created.\"+NL+\n numChanges.AsString++\"substitution(s) made.\",\"\")\n\n\n" ) (DocWin.6 Owner: 5 X: -4 Y: -4 W: 1034 H: 643 ) (CSMgr.7 ) (LButn.8 HelpTopic: "New_button" Update: "Doc.NewUpdate" Label: "&New" Click: "View.New" ) (LButn.9 Disabled: 1 HelpTopic: "Open_button" Update: "Doc.OpenUpdate" Label: "&Open" Click: "Doc.Open" ) (LButn.10 Disabled: 1 HelpTopic: "Print_button" Update: "Doc.ActionUpdate" Label: "P&rint" Click: "Doc.Action" ) (NameDict.11 ) (FN.770 Path: "$HOME" ) (TClr.771 Red: 0xffff Green: 0xffff ) (AVStr.772 S: "View" ) (AVStr.773 S: "Table" ) (AVStr.774 S: "Chart" ) (AVStr.775 S: "Layout" ) (AVStr.776 S: "Script" ) (AVStr.777 S: "Project" ) (AVStr.778 S: "Appl" )