This is documentation for Mathematica 5, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.1)

Documentation / Mathematica / Add-ons & Links / AuthorTools / Function Interface /

Introduction

Most AuthorTools functions require you to specify a notebook as the first argument. In general, you can specify a notebook either as a notebook object or a notebook file.

Notebook Objects

The Mathematica kernel refers to any open notebook via an expression of the form NotebookObject[fe, id], where fe specifies the front end in which the notebook is open and id is a unique serial number for the notebook.

The command Notebooks[] returns a list of notebook objects corresponding to all notebooks currently open in the front end.

In[1]:=

Out[1]=

This assigns the variable nb to represent the first notebook object in the list.

In[2]:=

Out[2]=

Notebook Files

Alternatively, you can identify a notebook by specifying the name and location of the notebook file. You can use the ToFileName function to construct a string specifying the full path name of the file.

In[3]:=

Out[3]=

Loading the Package

This loads the AuthorTools package.

In[4]:=

You can then use the symbol nb as an argument to any notebook function.

In[5]:=

Out[5]=

Processing Multiple Notebooks

You can use AuthorTools functions either to process a single notebook or multiple notebooks in the directory.

To process a single notebook:

Specify the notebook as the first argument of the function you want to use.

In general, a function that acts on notebooks can accept either a notebook object or a notebook file as the first argument. The exceptions are those functions that act on the current selection in an open notebook, for example, HorizontalInsertionPointQ, AddIndexEntry, SelectionRemoveCellTags, or IndexCellOnSelection. These functions can accept a notebook object as the first argument but not a notebook file.

To process multiple notebooks:

1. Create a project file that lists all the notebooks you wish to process. (See Creating a Project File for more information.)

2. Specify the project file as the first argument of the function you want to use. Alternatively, load the project file using the MakeProject dialog box, then use the notebook object corresponding to the dialog box as the argument of the function.

In general, a function that accepts a notebook file will also accept a project file. The exceptions are those functions that are only defined for a single notebook and hence cannot be applied to a project, for example, NotebookName, NotebookFolder, NotebookCellTags, or NotebookFileOptions. These functions can accept a notebook file as the first argument but not a project file.