English

How To: Extract data source paths from a project file

Summary

This article includes a sample script that will create a new text file with a complete list of the full path names to all data sources referenced in the project, including extensions.

For other scripts similar to this one, see the Related Information section.

Procedure

  1. Open a blank project.
  2. Open a new script window.

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

  3. Paste the following into the new script window:

    Code:
    '-- paths.ave
    '
    '-- Run through a project file and write a line to a
    '-- new text file whenever it sees a path statement

    infile=filedialog.show("*.apr", "*.apr", "What project file to pull paths out of")
    if (infile = nil)
    then exit
    end
    outfile=filedialog.put("*.txt".asfilename, "Text File", "What text file to create")
    if (outfile = nil)
    then exit
    end

    inLF=linefile.make(infile, #FILE_PERM_READ)
    outLF=linefile.make(outfile, #FILE_PERM_WRITE)

    LFS=inLF.getsize
    msgbox.info(LFS.Asstring,"Number of lines in project file")

    for each ln in (1..LFS)
    av.setstatus((ln/LFS) *100)
    theReadLine=inLF.ReadElt
    if (theReadLine.Contains("Path:"))
    then
    outLF.WriteElt(theReadLine)
    end
    end

  4. Click the Compile button.
    [O-Image] Script compile button
  5. Click the Run button.
    [O-Image] Run compiled script button
  6. Select an .apr file.
  7. Type the name of the text file in the 'What text file to create' dialog box and click OK.