System Variable Manager

by Jonathan Hunt


How many times have you double-clicked on a text file, expecting it to load DeskEdit, and found the file has loaded Edit instead; or had a Sprite file load Snippet instead of Paint? The culprit is something called a system variable.

System variables control things like how the time and date are displayed, where scrap files are created, and what application is run when you double-click on a file. Applications use system variables to control their behaviour. For example, Edit uses them to store your choice of display font, background colour and so on. They can also be used to create alternative star commands - the command to catalogue a disc, *., isn't actually a real command, but merely an alias for *Cat.

System Variable Manager provides you with extensive control over the system variables, allowing you to create, rename and delete them, and modify their contents and type. You can also search for specific variables, and obtain various statistics on them. A very useful feature of this application is that you can save a system variable file that contains your preferred "run actions" for each filetype. Whenever you now discover that another application has changed one of them, simply double-click on the system variable file to restore it to your usual setting. 

LOADING
The application can be loaded by double-clicking on its icon in a filer window. Once loaded, the application has to read in the current state of the system variables; it brings up the hourglass and a window in the the middle of the screen to show you that it is doing this. The initialisation process may take a little while, especially if you are running the application on an ARM 2 machine, or if there are a large number of system variables defined. After all of the variables have been read, the window will close and the application's icon will appear on the icon bar.

Clicking Select on the icon will open the main window.

THE MAIN WINDOW
The main window contains all of the system variables. The name of the variable is shown on the left of the window in blue. The variable type (either String, Number, or Macro) is shown in the middle of the window in red. The variable value is shown on the right of the window in black. Clicking anywhere in the window with Select or Adjust will give it the input focus.

Single variables can be selected by clicking Select on the variable. Additional variables can then be selected by clicking Adjust.

To select a group of variables, click Select at one end of the group, and drag the mouse with Select held down to the other end of the group. If you get close to the edge of the window while you are dragging, the window will scroll automatically.

To select an additional group, drag the mouse with Adjust held down over the extra variables you want to select.

The window can be scrolled in the normal way with the scroll bars. In addition to this, you can scroll up and down with the cursor keys, as long as the window has the input focus.

Page Up or Shift+up arrow will scroll up a page.
Page Down or Shift+down arrow will scroll down a page.
Home or Ctrl-up arrow will scroll to the top of the window.
Ctrl-down arrow will scroll to the bottom of the window.

Clicking Menu in the window will bring up the main menu.

Variable Info
This window can be opened by selecting it from the main menu, scrolling off to the right of its entry in the menu, or by pressing F1.

It shows the following information:

System variables: Total number of variables, and what percentage they represent of the total number.

Strings: Number of string variables and what percentage they represent of the total.

Numbers: Number of number variables and what percentage they represent of the total.

Macros : Number of macro variables and what percentage they represent of the total.

Selected variables: Number of variables selected and what percentage they represent of the total.

Selected strings: Number of strings selected and what percentage they represent of the total number of variables selected.

Selected numbers: Number of numbers selected and what percentage they represent of the total number of selected variables.

Selected macros : Number of macros selected and what percentage they represent of the total number of selected variables.

Save
The Save window can be opened by scrolling off to the right of its entry in the main menu, or by pressing F3. Selecting the Save option from the menu has the same effect as clicking on OK with Select or Adjust in the Save window.

Files can be saved in the normal RISC OS fashion, either by dragging the icon to a filer window, or by typing in a file name and pressing Return or clicking on the OK icon with Select or Adjust.

The radio icons below the writable icon determine how the file should be saved.

If you save the variables as a SysV file, they can be loaded back into the application at a later stage, either by double-clicking on the file, or by dragging it to the SysVarMan icon or main window; the variables saved in the file will then be re-created. Any variables in memory with the same name as those in the file will be overwritten. The format of a SysV file is unique to this application.

If you save the variables as a Text file, the variables will be formatted neatly such that they can be viewed using Edit, or any other application capable of displaying ASCII files. Variables saved in this way cannot be loaded back into the application.

Update
This can be activated by selecting its option from the main menu, or by pressing F2.

It reads in the current state of all of the system variables, and updates the main window to match this. While the variables are being read, the hourglass will appear and a window will open, to let you know what is happening.

This option is necessary because the system variables could be altered (without SysVarMan being aware) by another application, or by the user invoking the *SET command from the command line.

Select All
This can be activated by selecting its option from the main menu, or by pressing Ctrl-A. It selects all of the system variables.

Clear
This can be activated by selecting its option from the main menu, or by pressing Ctrl-Z. It de-selects any system variables currently selected.

New
The New Variable window can be opened by selecting its option from the main menu, by scrolling off to the right of its entry in the menu, or by pressing F5. It allows new system variables to be created. The window contains three writable icons:

In the top icon you enter the name of the new variable.

In the middle icon you enter the new variable's type. The type can either be a string, a number or a macro. To set the variable type to a string, press S. To set it to a number, press N. To set it to a macro, press M.

In the bottom icon you enter the value for the new variable. If the new variable is a string, you can refer to other variables by enclosing their names in single quotes. For example, if you were creating a new string variable called Test, and you put Time = Sys$Time, the variable would be created with the a value similar to Time = 12:24:30. To include leading spaces in the value, the string must be enclosed in quotation marks (""). To include special control characters (ASCII codes less than 32 or greater than 126), you need to use a '|' followed by the symbol corresponding to the required control character. A full list of control characters and the symbols used to obtain them is given in the Programmer's Reference Manual under the section referring to OS_GSRead. The same information can be found in the RISC OS 2 User Guide on pages 471-472, and in the RISC OS 3 User Guide on pages 150-151.

You can use the cursor keys to move between the writable icons, and pressing Return will move the caret to the next icon. The variable will be created if you press Return when the caret is in the bottom icon, or if you click on OK with Select or Adjust. Clicking on Cancel with Select or Adjust will close the New Variable window, and the variable will not be created.

Find
The Find Variable(s) window can be opened by selecting its option from the main menu, by scrolling off to the right of its entry in the menu, or by pressing F4. The radio icons on the left determine how the search should take place, either by name or by value.

If you search by variable name, you can use wildcards in the search string. For example Ed* would find all of the variables starting with Ed. This type of search is not case sensitive.

If you search by variable contents, the search is slightly different. You can't use wildcards, and the search is case sensitive. The search finds any variables with a value containing the search string. For example ri would match with Print %0, Poscript, and Sprite.

Pressing Return or clicking on OK with Select or Adjust will start the search. Clicking on Cancel with Select or Adjust will close the find window and cancel the search. Clicking on Previous with Select or Adjust will put the previous search string into the writable icon.

Found window
This window will open if any variables were matched during a search. Matched variables will be selected, and you can step through them with the controls in the Found window. As you step through the variables, they will be highlighted in green and will move to the centre of the window.

The icon at the top of the window shows you how many variables were matched, and the number of the variable which is highlighted.

Clicking on Stop with Select or Adjust will close the Found window and remove the highlight.

Clicking on Previous with Select or Adjust will highlight the selected variable above the one currently highlighted. Clicking on Next with Select or Adjust will highlight the selected variable below the one currently highlighted.

Clicking on First with Select or Adjust will highlight the first selected variable. Clicking on Last with Select or Adjust will highlight the last selected variable.

If any of the icons are not applicable, they will be greyed out. For example, if you are on the last selected variable, Next and Last will be greyed out.

Not found window
This window will open if no variables were matched during a search. Clicking on OK with Select or Adjust will close the window.

Selection menu
This menu can be opened by scrolling off to the right of its entry in the main menu. The entry is greyed out if no variables are selected.

Update selection
This can be activated by selecting its option from the selection menu, or by pressing Ctrl-F2. It reads in the current state of the selected system variables, and updates the main window to match this. While the variables are being read, the hourglass will appear and a window will open, to let you know what is happening.

Save selection
The Save Selection window can be opened by scrolling off to the right of its entry in the selection menu, or by pressing Shift-F3. Selecting the Save option from the selection menu has the same effect as clicking on OK with Select or Adjust in the Save Selection window. Files saved from this window are the same as files saved from the main Save window, except that only the currently selected variables are saved.

Edit
The Edit variable window can be opened by selecting its option from the selection menu, by scrolling off to the right of its entry in the menu, by pressing Ctrl-E, or by double-clicking with Select over a variable.

This option allows you to edit the state of a system variable. The entry is greyed out if more than one variable is selected. The window contains three writable icons:

The top icon specifies the name of the variable. To rename a variable, edit this field.

The middle icon specifies the variable type. To change the type of a variable, edit this field. To change the variable to a string, press S. To change it to a number, press N. To change it to a macro, press M.

The bottom icon specifies the current value of the variable. If you want to alter the value, edit this field. You can refer to other variables and control characters in the same way as you did in the New Variable window.

You can use the cursor keys to move between the writable icons, and pressing Return will move the caret to the next icon. The variable will be changed if you press Return when the caret is in the bottom icon, or if you click on OK with Select or Adjust. Clicking on Cancel with Select or Adjust will close the Edit Variable window, and the variable will not be changed.

Delete
This can be activated by selecting its option from the selection menu, or by pressing Ctrl-X. It deletes the currently selected system variables.

Find in selection
The Find Variable(s) in Selection window can be opened by selecting its option from the selection menu, by scrolling off to the right of its entry in the menu, or by pressing Ctrl-F4. It works in exactly the same way as the main find window, except that the search string is compared with the selected variables, rather than all of the variables.

Pressing Return or clicking on OK with Select or Adjust will start the search. Clicking on Cancel with Select or Adjust will close the find window and cancel the search. Clicking on Previous with Select or Adjust will put the previous search string into the writable icon.


 Copyright RISC User 1993
