[ Home | Prev | Next ]

Chapter 2: continued


Quick Scripts

First, let's look at the "Quick Script" button, and the window it opens, the Quick Script window (see Figure 2-3).


Figure 2-3. The Quick Script Window

To use the Quick Script window, just type an expression into the editing area (the larger rectangle at the top of the window) and either click on the "Run" button or press the Enter key (not the Return key). In Figure 2-4, the user has typed an arithmetic expression into the window and executed it. The result is shown in the message area at the bottom of the window.


Figure 2-4. Sample Quick Script Expression

When you type into the Quick Script window you're actually writing and running a one-line UserTalk script. To prove it, try typing something that makes no sense, as in Figure 2-5.


Figure 2-5. Nonsense Entry in Quick Script Window

Frontier responds with an error window with a message explaining why it didn't like what you typed (see Figure 2-6). Although the window looks similar to Quick Script, notice that the title is "Error Info" and the button is labelled "Go To". Clicking on the button will take you to the source of the error. This feature doesn't save much time when running from one-liners from the Quick Script window, but it's a big help later on when you write complete scripts.


Figure 2-6. Typical Error Message

Type the script shown in Figure 2-7 into the Quick Script window and press the Enter key (or click Run):


Figure 2-7. One-Line Script in Quick Script Window

Now, check out the Main Window. As you can see (Figure 2-8), the text in parentheses in the small script you just typed appears in the Main Window in place of the status information that was there originally. (You can return the Main Window to its normal task of showing you the present time and memory available simply by clicking on it.)


Figure 2-8. Message Displayed in Main Window

The first part of the script you typed in Figure 2-7 -- the word msg -- is a Frontier "verb" (a command or function). It requires one parameter, a string of characters surrounded by double quotes. The parameter must be enclosed in parentheses. (In fact, even if a verb has no parameters, it still requires parentheses.) The msg verb displays the string parameter in the Main Window. All Frontier verbs return a value when they execute unless they produce an error message. When you run a script from the Quick Script window, this result will be displayed in the message area of that window. As you can see in Figure 2-7, msg returned a value of "true," indicating that the verb executed successfully. (In fact, msg always returns "true" because it can't fail.)

The Frontier scripting language UserTalk implements hundreds of verbs. They all follow the same pattern. Verbs have names, take parameters (enclosed in parentheses), and return values. (Full documentation on the UserTalk verbs can be found in DocServer.)

Some verb names are structured, that is, they have the verb "category" as part of the name. Figure 2-9 presents an example of such a verb. The name of the verb is string.upper. This name tells Frontier to look in the Object Database in a table named "string", for a verb named "upper". As you can see, string.upper takes a string as a parameter, and returns the same string converted to uppercase. While the "category.name" format may take some getting used to, the organization it offers is important for managing the wealth of verbs built into Frontier.


Figure 2-9. Frontier Verb With Structured Name

Contents Page | Previous Section | Next Section -- Variables, the Object Database, and Tables


HTML formatting by Steven Noreyko January 1996, User Guide revised by UserLand June 1996