Scripted Documents (*DRAFT*) Polle T. Zellweger Computer Science Laboratory Xerox Palo Alto Research Center 3333 Coyote Hill Road Palo Alto, CA 94304 415/494-4426 Abstract We have developed a novel mechanism that we call a script, which provides a way to layer additional structure on top of an electronic document or set of documents. A script is a directed path through a document or set of documents that need not follow their linear order. The scripting mechanism is all the more powerful when combined with other capabilities of online multi-media documents, for they can incorporate sound, images, and actions. Built on top of conventional document (file) system, gives much of feel of hypermedia system [vanDam85]. Branching scripts are like cross-referenced documents w multiple links (but choice can be made by program rather than user). Certainly more than hypermedia in automatic mode; seems like different styling even in single-step mode. One difference is that scripts can visit the same location multiply with different actions. Introduction Suppose that you are writing a technical manual or some other document with a complex internal structure. Using traditional methods, you would be forced to linearize your ideas to fit into a single front-to-back, top-to-bottom sequence of words and pages. Additional structure could be expressed only as a textual list of cross-references from one section to other related sections. In addition, this single linear sequence must serve all of the document's readers. To combat this, books and manuals sometimes contain reading instructions in the preface, explaining the order in which different types of readers should peruse the material. For example, they might instruct readers who are unfamiliar with the subject matter to read the appendix first and to skip the second chapter and skim the third and fourth chapters on the first reading. More knowledgeable readers might be instructed to read the document straight through. We have developed a mechanism that we call a script, which provides a way to layer additional structure on top of an electronic document or set of documents. A script is a directed path through a document or set of documents that need not follow their linear order. Each entry in a script consists of a document location, which is a contiguous sequence of characters, together with an associated action and an associated timing. A sample action might consist of playing back a previously-recorded voice annotation, sending some text to a text-to-speech synthesizer, opening a new window, or running a program, which might animate a picture or retrieve items from a database. A single document can have multiple scripts traversing it for different purposes, and a single script can traverse multiple documents to organize collections of information. A script can be played back as a whole, in which case the cursor moves to the first location (l1) in a document and performs its associated action (a1). The document scrolls to display that location if the location does not currently appear on the screen, and the location is highlighted to call attention to it. After the associated time (t1), the cursor moves to the location specified in the next script entry (l2), performs its action, and so on. The same location in a document can appear at multiple points in the script, with the same or different associated actions and timing. Another way to play a script is more user-directed. In this case, the timing information is ignored, and the script reader proceeds from one entry to the next at his or her own pace. Arbitrary actions at a scripted location allow scripted documents to perform a wide variety of tasks: demonstrations, tutorials, etc. Parameterized actions allow a script to be personalized ("Hi ") or to more accurately reflect the current state of affairs ("There are entries in this category"). For speech, this capability requires a text-to-speech synthesizer. A script is written by a script writer, who may or may not be the same person who wrote the underlying document(s). A person who plays the script back is called a script reader. Scripts can be very formal items that are carefully crafted for pedagogical reasons, like a videotape, a demonstration, or a presentation. Or they can be informal, used to communicate from a single script writer to a single script reader (who might well be the same person). Example 1: formal script ....imagine a formal script for a presentation here... Example 2: informal communication from a reviewer to an author An author writes a document and submits it in electronic form to a reviewer. The reviewer makes vocal annotations about the document and collects these annotations into a script. The script might traverse the document in decreasing order of importance of the needed changes. Within the script, examples of a single problem could be collected together. For example, suppose that there are three places in the document where the author refers to linked lists, but he uses slightly different terminology at each place. The script might have an initial entry describing the overall problem of confusing terminology, immediately followed by entries at each of the confusing spots, with remarks about particular difficulties at each. In this way, the script approximates the reviewer sitting down with the author and a copy of the document, making comments and flipping back and forth through the document to substantiate these comments. The reviewer could make multiple scripts on different topics, such as positive comments and negative comments, or overall comments and specific typographic and spelling corrections. Comments from multiple reviewers could be represented as multiple scripts. Example 3: informal organizing technique for writers Scripts could also be used as an organizing technique during authoring, similar to 3x5 note cards. When analyzing a source document, the user could create multiple scripts on different topics. These scripts could be reordered as needed. The use of voice to collect the information could make the whole process very quick and painless. Related Work Different scripts through a single document can focus on different aspects of the subject matter. In this way, scripted documents are a form of hypertext [DelSch86], [DonWid86], [HalMorTri86]. The script approach has the positive aspect that the script reader need not bring as much knowledge and direction to viewing the document, but the negative aspect that the script reader can only traverse connections that have been prepared by the script writer. Scripts are also similar to Knuth's WEB programming language [Knuth84], in that WEB programs can traverse their documentation in arbitrary ways to organize the material as desired. However, WEB programs have a single ordering in their human-readable form. Scripted documents also bear a similarity to Feiner, Nagy and van Dam's interactive documents [FeiNagVan82]. Their system was primarily intended for the creation of high-quality interactive books, with high-quality images and animations. It was intended that the books be created by professional writers and illustrators. While formal scripted documents would certainly require care in their preparation, scripted documents also have a variety of more informal uses, as decribed earlier. Creating and editing scripts Abstractly, a script is a separate entity that refers to underlying document(s). However, in our prototype implementation, script entries are part of each scripted document, although the script must be activated separately. The document can be viewed without activating the script. Although a script is part of its associated document(s), a separate Script Tool is used to create and edit scripts. The prototype Script Tool is a forms-based tool with a simple set of operations. To issue a command, the script reader or script writer fills in the fields appropriate to that command and then clicks a mouse button over the command name. Script editing operations These operations are treated as edits to the document in which the script entry appears. Create script [scriptname]. This operation creates a new script, allowing the script writer to name the script with an arbitrary string. Destroy script [scriptname]. This operation removes the named script from all associated documents. Add entry [selection, scriptname, seqNum, action]. This operation adds the selected location to the named script after entry seqNum (that is, as entry number seqNum+1). The script writer fills in the action field as a textual sequence of commands. These commands can include calls to specially-written user procedures. The script tool records the filename with each script entry. Delete entry [scriptname, seqNum]. This operation removes entry number seqNum from the script. Script examination operations Find entry [scriptname, seqNum]. This operation scrolls the document to entry number seqNum and highlights its location. It also displays the associated action in the tool's action field. Next entry/Prev entry [scriptname, seqNum]. These operations allow the user to step through the named script easily in either direction. Next (Prev) entry is equivalent to incrementing (decrementing) seqNum and clicking Find entry. List scripts [selection]. All script names that appear in the selected document are listed in the script tool's message area. List entries [selection]. All