Make Project
Introduction | Handling a Project |
Creating a Project File | Processing Multiple Notebooks Programmatically |
Introduction
The Make Project dialog box makes it easy to set up and manage projects involving multiple notebooks. For example, you can use this dialog box to generate a unified table of contents or index for a set of notebooks.
Creating a Project File
The first step in processing multiple notebooks is to create a project file. This is a file that specifies the names and location of all notebooks in a project. You can create any number of project files, one for each project you are working on. Each project file has a .m suffix.
To create a project file:
1. Open the Make Project dialog box.
2. Type in a name for your project in the Name of Project text box.
3. Click Target Directory. A file browse dialog box appears.
4. Select a file in the directory containing your source notebooks. The full pathname of the directory is pasted into the Directory text box.
5. Click Select all. A list of all notebook files in the directory you specified appears in the Files text box.
6. Edit the list to delete any notebooks that do not belong in the project.
1. Click Save under the Project File tab and navigate to the directory containing your project notebooks.
2. In the file save dialog type a file name – the name of the project with .m appended. Click Save in the file save dialog to save the project file.
Handling a Project
To process all notebooks in a project:
1. Open the Make Project dialog box.
2. Click Load and choose the project file you need. (If you have not already created a project file, see "Creating a Project File" to learn how.)
3. With the Make Project dialog box as the current notebook, click the button for the palette you want to use. The palette functions will apply to all notebooks in the specified project.
Once you have loaded a project, you can use the buttons under the Project Actions tab to perform a variety of tasks.
Processing Multiple Notebooks Programmatically
Creating a Project File
The first step in processing multiple notebooks is to create a project file. This is a file that specifies the names and locations of all notebooks in a project. You will need to create a different project file for each project you are working on.
A project file is a plain text file with a .m suffix. The file must include data in the following format.
Here name is the name of the project, directory is the full pathname of the project directory, and {nb1,nb2,…} is a list of all notebooks that make up the project.
There are several different ways to create a project file:
- Enter the project data in the text fields of the Make Project dialog box. (See "Creating a Project File" for details.)
- Use the command WriteProjectData[file,data], where data specifies the project data in the list format shown in the preceding box.
Using a Project File
Once you have created a project file, you can process all notebooks in the project in one step. To do this, you simply specify the project file as the argument to the AuthorTools function you want to use.
For example, to generate a table of contents for a project, you can evaluate the command MakeContents[projectfile,"Book"]. The command for generating a table of contents for a single notebook is MakeContents[nb,"Book"].
Editing a Project File
When you evaluate an AuthorTools function with a project file as an argument, the Wolfram Language uses Get to read in the project file. Any Wolfram Language commands present in the project file are evaluated at this time. Thus, the project file is a convenient place to store commands that you want to apply to a project.
For example, suppose you prepend the following command to the contents of your project file.
This sets the option SelectedCellStyles of the AuthorTools function MakeContents. If you then use MakeContents to create a table of contents for that project, the option setting specified in the project file will be automatically used, overriding the default behavior of MakeContents.
Note: Any commands you have added to a project file will be overwritten if you use the WriteProjectData function or the Make Project dialog box to modify the project file.