Team LiB   Previous Section   Next Section

Chapter 20. Apple Data Detectors Extension

Apple Data Detectors (ADD) is a technology that Apple Computer introduced during the late 1990s. It allows a scripter to specify an AppleScript for the processing of certain types of information that users encounter in desktop windows, such as web site addresses or geographic locations. Apple Data Detectors are designed to identify these important snippets of data, including email and Newsgroup addresses, in almost any application window you might be working in. Figure 20-1 shows the Apple Data Detectors 1.02 control panel.

Figure 20-1. Apple Data Detectors control panel
figs/ascr_2001.gif

For example, you might be in AppleWorks, WordPerfect, or Microsoft Word and come upon a Uniform Resource Locator (URL) that you want to open up in your browser and visit. Or you find an email address of someone to whom you would like to send an instant email message. Rather than manually cut and paste the URL or email address into another application (which might not even be running at the time), ADD allows you to select the text or paragraph that contains the text and then Control-click the selection. Up pops a contextual menu in the canvas space of the window. The menu contains a list of actions that you can perform with the selected data—even if you just selected a whole paragraph surrounding the text. ADD is designed to look for and pull out evidence of the specified data in the chunk of selected text, such as protocol strings (e.g., "http," "ftp") or Newsgroup prefixes such as "comp."

These menu actions might include the text "Open URL in Netscape Communicator" or "New OutLook Express Message Recipient." Once you choose the action in the contextual menu, an AppleScript is executed to process just the snippet of text that you are targeting! ADD does not always work as intended, however; you have to experiment, test, and debug.

ADD has to be installed on your system before you can use it. As of the spring of 2001, you can download and install ADD 1.02 from the following address:

http://www.apple.com/applescript/data_detectors/updates.00.html

The ADD installation puts dozens of Apple's "actions" or scripts inside of startup disk:System Folder:Apple Data Detectors:Actions, along with the Internet Address Detectors (IAD) software. IAD detects web URLs, email addresses, FTP sites, Internet hostnames (www.apple.com), and USENET newsgroups in window text. With separate downloads, you can also install U.S. Geographic Detectors, which can recognize city or state references such as "San Francisco, CA." One of the associated geographic actions looks up a map for the selected city at the Yahoo! map web site. Apple has also promised to release a Currency Detectors package that will work with currency formats (e.g., $1,200) in various languages.

This is powerful functionality, yet the technology gets even more inspiring when you imagine all of the AppleScripts you can write yourself and use with ADD. While the ADD control panel itself is minimally scriptable with Mac OS 9 (you can send it basic Apple events such as activate), the types of scripts that you can develop and trigger by using the Apple Data Detectors Scripting osax offer greater possibilities. (Appendix A, goes into detail about scripting additions or osax.) The script in the Examples section creates a new Outlook Express email message from any email addresses that Internet Address Detectors detect.

    Team LiB   Previous Section   Next Section