(***********************************************************************
Mathematica-Compatible Notebook
This notebook can be used on any computer system with Mathematica 4.0,
MathReader 4.0, or any compatible application. The data for the notebook
starts with the line containing stars above.
To get the notebook into a Mathematica-compatible application, do one of
the following:
* Save the data starting with the line of stars above into a file
with a name ending in .nb, then open the file inside the application;
* Copy the data starting with the line of stars above to the
clipboard, then use the Paste menu command inside the application.
Data for notebooks contains only printable 7-bit ASCII and can be
sent directly in email or through ftp in text mode. Newlines can be
CR, LF or CRLF (Unix, Macintosh or MS-DOS style).
NOTE: If you modify the data for this notebook not in a Mathematica-
compatible application, you must delete the line below containing the
word CacheID, otherwise Mathematica-compatible applications may try to
use invalid cache data.
For more information on notebooks and Mathematica-compatible
applications, contact Wolfram Research:
web: http://www.wolfram.com
email: info@wolfram.com
phone: +1-217-398-0700 (U.S.)
Notebook reader applications are available free of charge from
Wolfram Research.
***********************************************************************)
(*CacheID: 232*)
(*NotebookFileLineBreakTest
NotebookFileLineBreakTest*)
(*NotebookOptionsPosition[ 4920, 146]*)
(*NotebookOutlinePosition[ 5582, 170]*)
(* CellTagsIndexPosition[ 5538, 166]*)
(*WindowFrame->Normal*)
Notebook[{
Cell[TextData[{
"Automatic printing of multiple ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" files"
}], "Section"],
Cell["Roeland Merks, University of Amsterdam, 2001", "Subsubtitle"],
Cell[TextData[{
"In the lab course on simulation and modelling I am assisting, the students \
have to turn in their work electronically as a ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" notebook. The reports are then printed and corrected with hand-written \
remarks. "
}], "Text"],
Cell[TextData[{
"This notebook will help you with printing all the ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" notebooks in a directory. It converts all ",
StyleBox["Mathematica",
FontSlant->"Italic"],
" notebooks in a directory to PostScript files."
}], "Text"],
Cell["\<\
The following function prints out all the files in the list \"files\
\". The directory of these files should be set in \"dir\"\
\>", "Text"],
Cell[BoxData[
\(\(\(PrintAllNotebooks[dir_, files_] :=
Module[{report}, \(Table[\[IndentingNewLine] (*\
Open\ a\ notebook\ *) \[IndentingNewLine]report =
NotebookOpen[
ToFileName[dir, files[\([i]\)]]]; \[IndentingNewLine] (*\
Open\ all\ cells\ \
*) \[IndentingNewLine]FrontEndExecute[{FrontEndToken[
report, "\"]}]; \
\[IndentingNewLine]FrontEndExecute[{FrontEndToken[
report, "\"]}]; \
\[IndentingNewLine] (*\
Print\ to\ a\ PostScript\ file\ \
*) \[IndentingNewLine]NotebookPrint[report,
ToFileName[dir,
files[\([i]\)] <> "\<.ps\>"]]; \[IndentingNewLine] (*\
Close\ the\ notebook\ *) \[IndentingNewLine]NotebookClose[
report];\[IndentingNewLine], {i, 1,
Length[files]}];\)];\)\(\n\)\)\)], "Input"],
Cell["\<\
Below, set the directory where mathematica can find your notebooks. \
Do this in the following format.\
\>", "Text"],
Cell[BoxData[
\(\(reportdir =
ToFileName[{$HomeDirectory, "\", "\"}];\)\)], "Input"],
Cell[TextData[{
"If the files are in the directory from which you started ",
StyleBox["Mathematica",
FontSlant->"Italic"],
", evaluate the following cell."
}], "Text"],
Cell[BoxData[
\(\(reportdir = {$InitialDirectory};\)\)], "Input"],
Cell["Evaluate the following cell to get a list of the files ", "Text"],
Cell[BoxData[
\(SetDirectory[reportdir]; reportfiles = FileNames["\<*.nb\>"]\)], "Input"],
Cell["You can off course also enter the filenames manually.", "Text"],
Cell["\<\
Please evaluate the following cell to check whether this list \
indeed contains only and all the files you want to print.\
\>", "Text"],
Cell[BoxData[
\(reportfiles\)], "Input"],
Cell["\<\
By evaluating the following cell, each notebooks in the list is \
opened. Then, all subgroups are opened and the files is printed to a \
PostScript file called \"notebook_name\".ps. Then, the file is closed and the \
next file is converted into PostScript.\
\>", "Text"],
Cell[BoxData[
\(PrintAllNotebooks[reportdir, reportfiles]\)], "Input"]
},
FrontEndVersion->"4.0 for X",
ScreenRectangle->{{0, 1280}, {0, 1024}},
CellGrouping->Manual,
WindowSize->{512, 600},
WindowMargins->{{0, Automatic}, {Automatic, 179}}
]
(***********************************************************************
Cached data follows. If you edit this Notebook file directly, not using
Mathematica, you must remove the line containing CacheID at the top of
the file. The cache data will then be recreated when you save this file
from within Mathematica.
***********************************************************************)
(*CellTagsOutline
CellTagsIndex->{}
*)
(*CellTagsIndex
CellTagsIndex->{}
*)
(*NotebookFileOutline
Notebook[{
Cell[1717, 49, 130, 5, 57, "Section"],
Cell[1850, 56, 67, 0, 57, "Subsubtitle"],
Cell[1920, 58, 297, 7, 68, "Text"],
Cell[2220, 67, 287, 8, 50, "Text"],
Cell[2510, 77, 150, 3, 50, "Text"],
Cell[2663, 82, 960, 18, 283, "Input"],
Cell[3626, 102, 126, 3, 50, "Text"],
Cell[3755, 107, 112, 2, 27, "Input"],
Cell[3870, 111, 177, 5, 50, "Text"],
Cell[4050, 118, 69, 1, 27, "Input"],
Cell[4122, 121, 71, 0, 32, "Text"],
Cell[4196, 123, 93, 1, 43, "Input"],
Cell[4292, 126, 69, 0, 32, "Text"],
Cell[4364, 128, 145, 3, 50, "Text"],
Cell[4512, 133, 44, 1, 27, "Input"],
Cell[4559, 136, 280, 5, 68, "Text"],
Cell[4842, 143, 74, 1, 27, "Input"]
}
]
*)
(***********************************************************************
End of Mathematica Notebook file.
***********************************************************************)