About the NoteTaker Sample
The NoteTaker Sample can be useful in a distance learning environment or as a sales tool. The sample Microsoft Word template (.dot) file contains all the code necessary to insert a Windows Media Player control in a new document, play a local .asf file, and populate the document with text.
The NoteTaker Sample works similarly to the DHTML and Online Training samples in this SDK. The only difference is that text in the script commands is printed to a Word document, instead of being sent to a browser to trigger a DHTML event or change an image in a frame. The mechanism is the same: a script command is read by Windows Media Player, which then triggers a ScriptCommand event in the Word macro code, and adds the associated text to the document.
Expanding on the NoteTaker Sample
By editing the code in the template file, the NoteTaker Sample can be modified in many interesting ways. The following are examples of how you can expand on the NoteTaker Sample.
- E-mail the .dot file. The Microsoft Word template and .asf file are small enough to be sent through e-mail or downloaded from a Web site.
- Stream from a remote server. The template file can be changed to point the embedded Windows Media Player control to an .asf file located on a remote Windows Media server on the Internet or a local network. This method can be of use in online training. Instead of viewing a training session using a Web browser, the user can receive the session directly in a Microsoft Word document. For more information on Web-based training, see the Online Training Sample in this SDK.
- Play a live stream. Instead of playing a prerecorded file, the presentation can be a live stream: a stockholders meeting, for example, complete with statistics and pie charts. Script commands containing text and formatting can be sent using a utility such as the Encoder Scripting Utility Sample included in this SDK. While viewing the event in a Microsoft Word document, the user receives text and charts, and can type personal notes in the document.
- Add Microsoft Word formatting. Formatting code can be added to the Microsoft Word template, so that text appears in a certain font style or size. Formatting options can be associated with different script command type strings that you define. Different type strings can cause text to be printed bold, right-aligned, in various styles and colors, or as a bulleted list. The following Visual Basic code in the Microsoft Word template causes the text received in the command string of the script command to print bold and with a bright green highlight when the type string "Attention" is sent.
Private Sub MediaPlayer1_ScriptCommand(ByVal scType As String, ByVal Param As String)
If scType = "Attention" Then
Selection.EndKey
ActiveDocument.Content.Bold = True
ActiveDocument.Content.HighlightColorIndex = wdBrightGreen
ActiveDocument.Content.InsertAfter Text:=Param & " " & vbCr
End If
End Sub
- Trigger Microsoft Word Macros. If a command string is too complex to be sent as a script command, the script command can simply trigger a macro that is contained in the template file. For example, the type string can be used to trigger a macro, and the command string can contain the variables. When the macro starts, it uses the variables to create a color bar chart.
- Make a playlist. Playback of Windows Media Player can be controlled by other objects in the document, including words or groups of words. This opens up many possibilities: glossary entries can be linked to .asf files that demonstrate correct pronunciations, and elements of a table of contents can play introductory videos when clicked.
Windows Media Player can also be embedded in other programs, such as Microsoft® Excel and Microsoft® Access. Lists of .asf file names can be expanded to full databases containing multiple fields of information and macros that play the files in any number of different ways. For example, you can create a large, searchable database of music that can be used to retrieve titles that fit certain criteria. The results of a search can then be used to generate a playlist. A macro can be created that plays the .asf files in the list, or automates the creation of a playlist in an .asx file. For more information, see ASX Scripting Overview.
See Also
Using the NoteTaker Sample, Windows Media Technologies Solutions Samples
© 1996-1999 Microsoft Corporation. All rights reserved.