Part 7 - Applications Revisited

Back in Part 5 of the tutorial, we took a look inside a typical RISC OS application directory and had a brief look at the files which you would expect to find inside. This time we're going to dig a little deeper into RISC OS applications to see what the !Boot & !Run files actually do.

Obey Files

Obey files are the most common type of file employed for !Boot & !Run files. These files are very basic sequences of commands to the operating system, although with the wealth of commands available, you can achieve some very clever and useful results if you try. These command sequences are often known in other operating systems (Unix variants) as Shell Scripts, they can have decision statements which only run if certain criteria are met.

To Help Illustrate how some of these work, I'll use an example from a popular application and attempt to explain how the applications load and register their file types.


Set ARMovie$Dir <Obey$Dir>

| Remove old cached information

Unset ARMovie$Access*

Unset ARMovie$Decom*

Unset ARMovie$Return*

Unset ARMovie$Version

If "<ARMovie$SoundDir>"="" Then Run <Obey$Dir>.MovingLine.SetSndDir

If "<ARMovie$PaintDir>"="" Then Set ARMovie$PaintDir <Obey$Dir>.MovingLine.PaintCode

| Set colour enquiry choice for CC's ColourCard

Set ARMovie$ColourMethod 10

| Now check if the ColourCard is there: if not, set colour enquiry to normal

RMEnsure ColourCard 0 Set ARMovie$ColourMethod 9

Set Alias$@RunType_AE7 Run <ARMovie$Dir>.Player %%*0

Set File$Type_AE7 ARMovie

Iconsprites <Obey$Dir>.!Sprites

RMEnsure colourtrans 0 RMLoad System:Modules.Colours

RMEnsure FPEmulator 0 RMLoad System:Modules.FPEmulator

As typical in most applications, this sets an application directory system variable (ARMovie$Dir) to the value of the special variable Obey$Dir. Obey$Dir is a system variable which is set to the directory path of the currently running Obey file. Every time a different Obey file runs, this variable changes its value. For this reason, applications must set their own system variable if they wish to know where they live within a file structure. This very simple mechanism of Obey$Dir being changed to match the running environment allows any application to detect its own location and yet always refer to its location in a standard manner (<App$Dir>).

You will have noticed that the first line uses "<" & ">" around the Obey$Dir. This tells the system to take the value of the system variable called Obey$Dir, rather than the literal string "Obey$Dir",

and copy it into the new (or already existing) system variable named after the Set command.

System variables remember the case (upper or lower) but are not actually case sensitive. This means that we can make them more readable with mixed case but also be lazy when making use of them if we need to. The system variables are used for a great many things. To view the current state of the system variables list, you can type *Show at a command prompt and you will see a long list of variables that both RISC OS itself and any applications which have been seen or run have created.

Looking at the next few lines of !Boot there are some Unset commands. As you might guess, these delete or unset the system variables named, so applications can clear up after they have run if necessary.


Next in the !Boot file we have a couple of simple *IFs. These evaluate the expression following and if true will execute the remaining command from that line. In particular ARMovie appears to be checking if the special path variables are not yet set up and if so sets them.


Skipping a few lines now, we se a command called RMEnsure; this command checks to see if the named Relocatable Module is already installed in memory the number (here a zero) checks if a particular version or later is present, if not then the remaining command is executed, usually to force a module to be loaded.

Alias Run Type

The command, Alias$@Runtype registers a particular filetype with a Run Action, that is to say if the particular filetype in question is double clicked, then the command at the end of the line will be executed. What all that means is that when an ARMovie file is double clicked, RISC OS will see this Alias and then Run the ARMovie Player with a parameter of the filename (the %%0 bit) that was double clicked.


The Set File$Type command associates the HEX file type with a textual description of the file type to make it easier to tell what kind of files things are.

Unknown Filetype information window

Known Filetype information window


Iconsprites loads a sprite file into the WIMP Sprite Pool. This allows applications (and the Filer) to reference the application's icons. Mostly this is in the !Boot file to ensure that an application's Icon is displayed correctly within the Filer.

This article is a little more technical than previous ones, so I'll leave it there for you to have a think about. Don't be afraid to go into the command line and type *Help and a command name to find out a little more.

Index - Back - Forward