Thomas Milius has released a new module designed to provide some extended system variable facilities. System variables, of course, are special variables used by the operating system to store information about the system, such as some settings, and by applications for similar purposes.
The module allows two special types of variables to defined, all of which can be accessed in the usual way from within RISC OS – which means they can be used in your own or third party programs, from the command line, in Obey files, and so on. The only prerequisite is that ExtdVars needs to be running.
The first of these is a ‘command variable’, created with the command ExtdVars_CreateCommandVar. When a variable of this type is set by ExtdVars, it should contain a command to be executed. When the contents of the variable are requested – for example, using a simple *show command at the command line – the command it contains is executed, and the first line of output produced by that command is what gets returned.
The second type of variable is a ‘question variable’, created with the command ExtdVars_CreateQuestionVar. This puts a question into the variable, along with some optional flags and parameters, and when its contents are accessed the question is asked of the user by calling Wimp_ReportError; a window appears and the user can respond to the question by clicking one of the buttons – which, depending on the flags, may be the usual Okay and Cancel buttons, or they may be set from those parameters. The value returned then depends on the user’s response.
The module also provides two in-built variables as standard. The first of these is ExtdVars$UUID, and whenever it is accessed it returns a ‘Universally Unique IDentifier’ (UUID) as defined by RFC 4122. The purpose of a UUID is to provide an identification for some event, record, or other piece of information that is as close to being unique as possible. For example, the iCalendar format – which is designed to allow users on different systems to share scheduling information such as meeting times and so on – makes use of UUIDs.
The other in-built variable is ExtdVars$ActualDir, which always returns the value of the currently selected directory – the one you will see the contents of if you press Ctrl-F12 to open a TaskWindow and hit the full stop key followed by Return.
Instructions and examples are provided with the module, which can be downloaded from the Computer Activities section of Thomas’ website.