UserTalk: The Radio Scripting Language
Last updated: 6/16/2002; 10:22:21 AM
The FuzzyBlog!

Marketing 101. Consulting 101. PHP Consulting. Random geeky stuff. I Blog Therefore I Am.

UserTalk: The Radio Scripting Language

UserTalk is the underlying scripting language for Radio. From a technical perspective, UserTalk is an Algol-derived language with a syntax reminiscent of Pascal. Among UserTalk's unique features are: <?xml:namespace prefix = o />

  • An integral object database for handling storage of variable length objects

  • Built in network connectivity and ability to script across different network protocols

  • A unique outline-based development environment that dramatically aids in managing the complexity of script development

The examples below are by no means a full guide to UserTalk. When O'Reilly previously published a book on UserTalk, when it was named Frontier, the guide was 592 pages. Clearly this is more of a taste of UserTalk than a full meal.

The UserTalk Development Environment

One of the most distinctive aspects of UserTalk beyond the language itself but actually the environment in which you develop UserTalk scripts. At the heart of Radio is an outliner and an outlining metaphor. This outliner can also be used to structure your code and manage large blocks of code with an expand and collapse approach.

To work in the UserTalk development environment, the first step is to go into "Full Radio", the non browser version of Radio, talked about in Chapter 3 under Republishing your entire blog.. Here's how.

On Mac OS X: Click the Radio icon in the Dock and choose Open Radio from the menu.
On Windows: Right click the Radio icon and choose Open Radio from the menu.

The Radio development environment is displayed. Most of the Radio development features are located on the Tools -> Developers menu as shown below.

<?xml:namespace prefix = v />

Here are the important commands that you need to know to take advantage of this environment.

  • Jump – lets you jump directly to routine within the overall UserTalk framework. Think of Jump as a way to go directly to a class.

  • Workspace – creates a new "workspace" or environment for you to work in with a local set of database entries

  • Quick Script – lets you enter a simple script in a text editor and run it. Ideal for simple utilities.

Although the UserTalk environment has additional tools, Jump, Workspace and QuickScript are the ones you use most frequently. A picture of the overall environment including a workspace and the outline-based scripting is shown below.

UserTalk Language Examples and Verbs

Now that you have seen the UserTalk development environment, here are some examples of how common programming tasks are accomplished. Please note that these examples were largely pulled from the UserLand documentation on UserTalk.

Like every language, UserTalk has conditional statements. An if structure may include an else block. It will be executed if the expression is false.

if answer > 6

   msg ("Big family!")


   msg ("Not such a big family!")

A fileloop structure iterates through every item in a folder or on a disk (or even every disk), assigning the loop variable to each element in turn. The example below will use the message box facility (msg) to display the filename that the script finds.

fileloop (f in path)

   msg (file.fileFromPath (f))

For more UserTalk examples, please see:

At the heart of UserTalk are a series of several hundred "verbs" (think statements in another language). All of these are documented online at the url: Shown below is a table of the different categories of verbs that make up UserTalk.

Verb Category

Uses, Comments and Notes


Handle numbers, datatypes, objects, etc.


Set and get system clock values. Time-stamp documents. Pause execution.


Get and set date values.


Display and return results from dialog boxes.


Emulate behavior of Radio's Edit Menu, including fonts and styles


All file operations, including copy, delete, move, create, and rename. Looking at file and folder contents, read and write text files, deal with volumes, parse path names, lock and unlock files, handle Macintosh aliases, etc.


Emulate behavior of the Radio File menu.


Turn agents on and off, make Radio the active application, and get information about Radio


Determine if the Command, Control, Option, and/or Shift key is down.


Open applications, control panels, documents, and code resources.


Manage and manipulate the Radio menubar and menubar objects


Find out where the mouse is and if the button is being pressed.


Edit, navigate in, rearrange, expand, collapse, retrieve information from and otherwise manipulate Radio outline objects.


Handle Radio's internal find-and-replace operations


Define the sound the internal speaker will make and activate it.


Manage and manipulate string objects, including fields, word and sentences.


Deal with external applications and find out what version of the Operating System is in use.


Manipulate and interact with Radio Object Database tables and their contents.


Determine the Radio object that will receive the next action(s) taken in the environment.


Manage and manipulate Radio windows.


Handle word processing objects and their contents, including setting properties, controlling the selection, formatting the appearance of text and changing its content.

Beyond the standard UserTalk verbs, UserTalk also has a very sophisticated set of operators for comparisons, evaluation and more.






Add numeric values or concatenate (join) string and character values


Subtract numeric values or remove the first occurance of one string from another




Division (integer or real, depending on the datatypes)


Modulus (remainder of integer division)


Test for equality


Test for inequality


Less-than comparison


Less-than-or-equal comparison


Greater-than comparison


Greater-than-or-equal comparison


Compare one string to the beginning of another


True if one string contains another


Compare one string to the end of another


Logical OR


Logical AND


Logical NOT








Dereference an address


Hello World Revisited

The classic test for programming languages is always "Hello World" - a simple script that does nothing but write "Hello World!" to the screen, console or dialog box.  As programming environments get more and more sophisticated, the Hello World application always becomes interesting. 

In Radio there are two ways to implement Hello World, Quick Script and as a saved script.  Radio's Quick Script command is a text editor window where you can enter one or more lines of code and then execute them.  A saved script is just that – a script that has been saved into the Radio environment so that it can be called by another routine.


We're going to start with a slight enhancement of our normal Hello World code to illustrate variable assignment and a function call along with just printing to the screen.  What we need to do is:

  1. Assign the text "Hello World!" to a variable, s.

  2. Force that text to be uppercase.

  3. Display that text.

Here's our code for this:


Local (s = "Hello World!");

s = string.upper (s);

dialog.notify (s);


An alternative to dialog.notify(s) would be to use return (s) and then call the macro from a web page or blog post as described in the next section.


This is pretty standard development stuff.  Here are some comments:

·         Line 1

o        Line 1 binds the text to the variable s. 

o        Line 1 also shows us that variables in UserTalk are untyped and dynamically converted between types as needed. 

o        The ";" is the delimiter between lines of code.

·         Line 2

o        string.upper is a string function which uppercases text.  All UserTalk functions are organized into "categories" and then referenced by "category.specific_function" syntax.

o        Another example is strong.cleanMailAddress which normalizes an email address (this lowerUpperCase is standard in UserTalk for multiple-word-type things)

o        Full documentation on UserTalk string functions is at:

·         Line 3

o        dialog.notify pops up a dialog box with a notify icon.

o        dialog.alert would pop up the same dialog box but with a different icon

Hello World with Quick Script

Here's how to write Hello World in UserTalk using Quick Script.

  1. Go into Full Radio as described earlier in this section.

  2. Use Tools -> Developers -> Quick Script to open the Quick Script window.

  3. Enter this text into the window:

    s = "Hello World!";

    s = string.upper ("Hello world!");

    dialog.notify (s);

  4. Click the Run button and you should see something like this:

Hello World as a Saved Script

Here's how to write Hello World in UserTalk as a script saved into the Radio environment.  As discussed earlier, Radio has a unique outline-based environment tied into it's overall object database.  The best way to think of Radio's object database is as a hierarchical set of name-value pairs.  These are referred to as tables.  The Radio object database stores the entire Radio environment including much of Radio's own code (above the level of system primitives, Radio is largely written in Radio).  Since the environment is hierarchical, it is very analogous to a class-browser-based system like SmallTalk or the Common Lisp Object System (CLOS).  In Radio the Jump command, CTRL+J, moves you into different sections of the system.  For example, if you type CTRL+J and then "callbacks" you are taken to "system.callbacks".  Note that Radio will automatically pre-pend "system." to your jump command if it's appropriate.  Once you jump to something you can, of course, open the script associated with it.  This is shown below in Figure 7-XXX.

In the UserTalk scripting environment, user code is stored in a table called "workspace".  What we're going to do is:

·         Go to workspace

·         Add a new script

·         Add our code

·         Test it by calling it from QuickScript

Here are the steps

1.        Select Tools -> Developers -> Jump.

2.        Type "workspace" (no quotes) and select Ok.

3.        Select Table -> New Script.

4.        Type "helloWorld" as the script name (again, no quotes) and select Ok.

5.        Paste in the text from the Quick Script window (yes, it will still be there).

If you click the Run button at the top of the window code editing window, you will get this error message:

What this error message means is that at the context of helloWorld itself, it can't be run.  However, if you go to the QuickScript window again and enter "workspace.helloWorld" and then click Run, this executes properly.  If you want to run this from the context of the script itself then add the line "helloWorld()" to the end of the script.

Copyright 2002 © The FuzzyStuff