*Obey

A new module, Obey, has been written to allow text files containing *commands to be executed directly, rather than by using *EXEC and assuming that the foreground task is sending keyboard input to OS_CLI.

        Syntax:  *Obey <filename> [<parameters>]

The command also automatically sets the variable Obey$Dir to the name of the parent directory containing the file, by extracting it from the <filename> provided. The absoluteness of this pathname depends on how absolute the original filename was (eg. *Obey fred.jim leaves Obey$Dir = "fred", which is all very well until the current directory changes!)

Any references to %0 to %9 within the file are taken to be references to the parameters on the original command line, so it is possible to pass parameters to these files. This does mean, however, that commands which want to specify %0 literally must use %%0 instead. Note that %*0 gives the whole of the command line after the <filename>.

It is recommended that programs which want to keep a tag on their parent directory execute a command of the following form within their Obey file:

        *Set foo$dir <Obey$Dir>

Thereafter the parent directory can be referenced by using <foo$dir> in filenames.

Finding the parent directory

The parent directory is found by stripping '.<leafname>' from the end of the filename given to *Obey, which may contain an element from Run$Path combined with the name specified in the original command. For example,

        *Set Run$Path adfs::Winnie.Deskworld.!
        *foo xyz

would produce the equivalent of:

        *Run adfs::Winnie.Deskworld.!foo xyz

which (if !foo.!Run has filetype &FEB) would produce the equivalent of:

        *Obey adfs::Winnie.Deskworld.!foo.!Run xyz

The latter conversion is achieved by a combination of the FileSwitch treatment of !Run files, and the setting-up of the filetype &FEB as follows:

        *Set Alias$@RunType_FEB Obey %*0
        *Set File$Type_FEB Obey