Introduction to the Smart Tag Explorer and Smart Tag Recognize Tester

 

Chris Kunicki
OfficeZealot.com

September 2004

Applies to:
   Microsoft Office 2003 Editions

Summary:   Discover two important smart tag utilities. The Smart Tag Explorer provides the developer with a visual interface for browsing smart tag information related to on their workstation and targeted platforms within their enterprise. The Recognize Tester enables testing of a smart tag recognizer's Recognize method outside of a host application. (4 printed pages)

Contents

Introduction
Smart Tag Explorer
Information Bridge Framework Support
Recognize Tester

Introduction

The Smart Tag Explorer and Smart Tag Recognize Tester are a set of utilities intended to aid the smart tag developer in quickly building efficient, stable, and robust smart tags for a variety of applications. These utilities and documentation do not teach you about smart tags, or how to write them. For that purpose, download the Office 2003: Smart Tag Software Development Kit (SDK).

As smart tag developers progress in their understanding of the smart tag API and its architecture, as documented in the Microsoft Office Smart Tag SDK, they quickly realize there is need for a delicate balance between how a custom smart tag DLL, host application, and related data and actions must function together. For the developer, this typically raises questions and poses challenges to overcome. These include:

  • Which smart tags are installed on a system and what are their settings?
  • How do I manage the various smart tag settings at the individual smart tag level and for each individual host application (Microsoft Office Word 2003, Microsoft Office Excel 2003, Microsoft Office Outlook 2003, and Microsoft Internet Explorer)?
  • Is there a way to test smart tags and avoid the complexities of constantly having to start and stop the host application?

To address these questions, the following utilities allow the smart tag developer to examine installed smart tag aids:

  • Smart Tag Explorer (STExplorer.exe) gives the developer a snapshot view of how smart tags are configured on their system.
  • The Smart Tag Recognize Tester (RecognizeTester.exe) allows for testing a recognizer's Recognize and Recognize2 methods outside a host application. This can simplify the complexity of testing recognizer code.

The source code for these tools, and any updates, is available in a workspace on GotDotNet.com. Community updates are encouraged.

Smart Tag Explorer

The Smart Tag Explorer provides you with a visual interface for browsing information related to smart tags on your development workstation and on targeted platforms within your enterprise.

You can use this information during the smart tag development process to verify that smart tags are reporting accurate information to the host application. Also, you can examine smart tags included with Microsoft Office 2003 Editions to discover how they work, providing an example as they design their own smart tags.

The tool reveals the following smart tag internal details:

  • Detailed settings for each installed recognizer and action DLL. This information includes a list of each installed DLLs, and for each DLL along with its name, description, ProgID, smart tag count, smart tag types, registry settings and other details.
  • Settings shared by all host applications. These include where to check for new smart tag recognizers, smart tag actions, and smart tag underline color.
  • Settings for each individual host application in Word and Excel. For example, if recognition is turned on, actions are displayed to the user, along with other details.

Most of the settings displayed by the Smart Tag Explorer are extracted from the smart tag libraries (both COM and Managed.) Therefore, the information is primarily read-only. Where possible, settings that can be changed on the fly can be edited within the Smart Tag Explorer.

Information Bridge Framework Support

The Smart Tag Explorer also examines your smart tag libraries to determine if it references the Information Bridge Framework. If a reference is found, the tool places an observation in the details window with the text "This assembly references the Information Bridge Framework." This observation is applied only to managed libraries at the assembly level, and displays for both the recognizers and actions. Because this observation looks for the reference in the assembly, the observation does not appear if the Information Bridge framework is used through Reflection.

Smart Tag Explorer Walkthrough

Figure 1. Smart Tag Explorer

The following numbered items describe the regions of the Global Smart Tag Settings page:

  • Region 1. The Smart Tag Explorer displays the name of any Smart Tag Recognizers or Actions in this window. To refresh the list, on the File menu, click Refresh (F5.) The red exclamation point indicates that there was an error loading the library while M indicates a library built using managed code and C indicates a COM library.
  • Region 2. The Item Details window shows static properties for this library as well as any observations made while loading.
  • Region 3. You can set registry settings (manually or by various Office applications) that enable a given library for any of the applicable applications. This area of the explorer shows which applications the selected tag (recognizer or action) is enabled for. When you click the display, you are presented with a dialog box for changing these values.
  • Region 4. The Smart Tag Types window displays the configured actions for a given Recognizer, or the menu items (and other associated details) when the selected library entry is an Action.
  • Region 5. The status bar for the application shows the Application name and LocaleID that the explorer will simulate when querying a library for properties. To change this, on the Tools menu, click Options.

Note   The Smart Tag Explorer uses the same registry paths that Microsoft Office uses to attain a list of installed recognizer and action DLLs: HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Recognizers HKEY_CURRENT_USER\Software\Microsoft\Office\Common\Smart Tag\Actions

Global Smart Tag Settings

Smart tag operation is dependent on a number of shared and individual host application settings. The Global Smart Tag Settings dialog box allows a developer to review and change these settings. To access this dialog in the Smart Tag Explorer, on the Tools menu, click Global Smart Tag Settings.

The Global Settings section shows settings shared by all smart tags. The Check for new smart tags at box is a URL or UNC path that Office uses when the user selects the More Smart Tags button in the Smart Tag tab in the AutoCorrect dialog box for Word or Excel. This setting by default opens Internet Explorer to the Available Smart Tags page on Microsoft Office Online so that users can access further smart tag downloads. The Check for new smart tag actions at setting controls the Web page presented to a user when invoking the Check for new actions menu option within a set of smart tag actions. You can override these default settings and redirect users to an internal Web site within an enterprise.

The final two sections display the current state of various host specific smart tag settings for Word and Excel. You can change all of these settings from within Word or Excel in various places, but they are provided together here for convenience.

Recognize Tester

Loading and unloading a host application constantly during the smart tag development process can be time-consuming. The Recognize Tester simplifies this challenge by allowing the smart tag developer to test the Recognize and Recognize2 method under development without the need of a host application being loaded. This can reduce the time and complexity of smart tag development.

Recognize Tester Walkthrough

First, start the Recognize Tester. Using this figure as a point of reference, let's walk through the process of testing a recognizer's Recognize method with this tool.

Once the application is running, note that you can run all tests from the main form in the application. The user can also resize the various panes as appropriate.

Figure 2. Smart Tag Recognize Tester

The following list describes the key regions of the Smart Tag Recognize Tester:

  • Region 1: This window region lists the Recognizer libraries installed on the system. You can select which ones you would like to test by clicking in the checkbox to the left of each item. You may notice that the following recognizers available with the Office 2003 Editions are not in this list: person names, dates, addresses, places, and telephone numbers. The Recognize Tester is designed to test custom recognizers developed within the enterprise. Therefore the Recognizer Tester iterates the registry looking for custom smart tag DLLs and makes those available for testing. The smart tags built into Office are not separate DLLs. Therefore they cannot be tested from within this tool. MOSTL tags are also not included in the tester options.
  • Region 2: Type the full text to test into this text box.
  • Region 3: A recognizer's Recognize method accepts an IF_TYPE. The IF_TYPE indicates the type of text data that is passed into the recognizer. Word uses IF_TYPE_PARA and Excel uses IF_TYPE_CELL. Select which IF_TYPE should be used for the recognizer test.
  • Region 4: To test the text, all you need to do is click the Recognize button (Ctrl+R) and the results display in region 4.

During the testing process, you can change any of the settings. Therefore, the smart tag developer can interactively work with different recognizers and sample text to recognize. Because the Recognize Tester loads the recognizer DLLs dynamically when Scan Text is clicked, there is no need to start and stop the Recognize Tester as would be required when working with Word or Excel.

About the Author

Chris Kunicki is a longtime enthusiast of Office development and has been evangelizing Office as an important platform for building solutions for many years. As the founder of OfficeZealot.com, a leading Web site on Office solutions development, Chris builds enterprise solutions, designs tools for developers, delivers presentations, and writes extensively on the topic of Microsoft Office. Find out more about Chris and Office at www.OfficeZealot.com or send him an e-mail message at chris@officezealot.com.

© Microsoft Corporation. All rights reserved.