Home » Archimedes archive » Acorn User » AU 1996-08.adf » Regulars » StarInfo/Boura/Manuals/AppEnsure

StarInfo/Boura/Manuals/AppEnsure

This website contains an archive of files for the Acorn Electron, BBC Micro, Acorn Archimedes, Commodore 16 and Commodore 64 computers, which Dominic Ford has rescued from his private collection of floppy disks and cassettes.

Some of these files were originally commercial releases in the 1980s and 1990s, but they are now widely available online. I assume that copyright over them is no longer being asserted. If you own the copyright and would like files to be removed, please contact me.

Tape/disk: Home » Archimedes archive » Acorn User » AU 1996-08.adf » Regulars
Filename: StarInfo/Boura/Manuals/AppEnsure
Read OK:
File size: 053E bytes
Load address: 0000
Exec address: 0000
File contents
AppEnsure
=========

Frequently, you may wish to ensure that an application is running, and start
it up if it is not already running.  "AppEnsure" meets this need.  It should
be placed in the "Director:utilities" directory.  It is used in a similar
way to the command *RMEnsure.

Syntax: AppEnsure <name> <command>

<name> the name of the application as registered with task manager (see the
task display).  This must be exactly the same, spaces and the case of the
letters are both significant.

<command> to execute if <name> is not found to be running.

As usual, name or command must be enclosed in quotes if they contain any
spaces.

Examples

  AppEnsure "CD Player" "Filer_run <AudioPanel$dir>"
  AppEnsure Edit "Filer_run <Edit$dir>"

Virtually all applications set up an operating system variable to record
where they are.  This, used with Filer_run, is the best way to start them up. 
Usually it is pretty obvious what it is likely to be called, eg Edit$dir, 
but with others, eg CD Player you will need to look in the !boot and/or !run
file(s) to find out.  If there isn't a suitable system variable, then either
use the full path name of the application, or add a suitable system variable
to BOTH the applications !boot file AND its !run file.  (If the !run file
executes the !boot file then it is only needed in the !boot file).
00000000  41 70 70 45 6e 73 75 72  65 0a 3d 3d 3d 3d 3d 3d  |AppEnsure.======|
00000010  3d 3d 3d 0a 0a 46 72 65  71 75 65 6e 74 6c 79 2c  |===..Frequently,|
00000020  20 79 6f 75 20 6d 61 79  20 77 69 73 68 20 74 6f  | you may wish to|
00000030  20 65 6e 73 75 72 65 20  74 68 61 74 20 61 6e 20  | ensure that an |
00000040  61 70 70 6c 69 63 61 74  69 6f 6e 20 69 73 20 72  |application is r|
00000050  75 6e 6e 69 6e 67 2c 20  61 6e 64 20 73 74 61 72  |unning, and star|
00000060  74 0a 69 74 20 75 70 20  69 66 20 69 74 20 69 73  |t.it up if it is|
00000070  20 6e 6f 74 20 61 6c 72  65 61 64 79 20 72 75 6e  | not already run|
00000080  6e 69 6e 67 2e 20 20 22  41 70 70 45 6e 73 75 72  |ning.  "AppEnsur|
00000090  65 22 20 6d 65 65 74 73  20 74 68 69 73 20 6e 65  |e" meets this ne|
000000a0  65 64 2e 20 20 49 74 20  73 68 6f 75 6c 64 0a 62  |ed.  It should.b|
000000b0  65 20 70 6c 61 63 65 64  20 69 6e 20 74 68 65 20  |e placed in the |
000000c0  22 44 69 72 65 63 74 6f  72 3a 75 74 69 6c 69 74  |"Director:utilit|
000000d0  69 65 73 22 20 64 69 72  65 63 74 6f 72 79 2e 20  |ies" directory. |
000000e0  20 49 74 20 69 73 20 75  73 65 64 20 69 6e 20 61  | It is used in a|
000000f0  20 73 69 6d 69 6c 61 72  0a 77 61 79 20 74 6f 20  | similar.way to |
00000100  74 68 65 20 63 6f 6d 6d  61 6e 64 20 2a 52 4d 45  |the command *RME|
00000110  6e 73 75 72 65 2e 0a 0a  53 79 6e 74 61 78 3a 20  |nsure...Syntax: |
00000120  41 70 70 45 6e 73 75 72  65 20 3c 6e 61 6d 65 3e  |AppEnsure <name>|
00000130  20 3c 63 6f 6d 6d 61 6e  64 3e 0a 0a 3c 6e 61 6d  | <command>..<nam|
00000140  65 3e 20 74 68 65 20 6e  61 6d 65 20 6f 66 20 74  |e> the name of t|
00000150  68 65 20 61 70 70 6c 69  63 61 74 69 6f 6e 20 61  |he application a|
00000160  73 20 72 65 67 69 73 74  65 72 65 64 20 77 69 74  |s registered wit|
00000170  68 20 74 61 73 6b 20 6d  61 6e 61 67 65 72 20 28  |h task manager (|
00000180  73 65 65 20 74 68 65 0a  74 61 73 6b 20 64 69 73  |see the.task dis|
00000190  70 6c 61 79 29 2e 20 20  54 68 69 73 20 6d 75 73  |play).  This mus|
000001a0  74 20 62 65 20 65 78 61  63 74 6c 79 20 74 68 65  |t be exactly the|
000001b0  20 73 61 6d 65 2c 20 73  70 61 63 65 73 20 61 6e  | same, spaces an|
000001c0  64 20 74 68 65 20 63 61  73 65 20 6f 66 20 74 68  |d the case of th|
000001d0  65 0a 6c 65 74 74 65 72  73 20 61 72 65 20 62 6f  |e.letters are bo|
000001e0  74 68 20 73 69 67 6e 69  66 69 63 61 6e 74 2e 0a  |th significant..|
000001f0  0a 3c 63 6f 6d 6d 61 6e  64 3e 20 74 6f 20 65 78  |.<command> to ex|
00000200  65 63 75 74 65 20 69 66  20 3c 6e 61 6d 65 3e 20  |ecute if <name> |
00000210  69 73 20 6e 6f 74 20 66  6f 75 6e 64 20 74 6f 20  |is not found to |
00000220  62 65 20 72 75 6e 6e 69  6e 67 2e 0a 0a 41 73 20  |be running...As |
00000230  75 73 75 61 6c 2c 20 6e  61 6d 65 20 6f 72 20 63  |usual, name or c|
00000240  6f 6d 6d 61 6e 64 20 6d  75 73 74 20 62 65 20 65  |ommand must be e|
00000250  6e 63 6c 6f 73 65 64 20  69 6e 20 71 75 6f 74 65  |nclosed in quote|
00000260  73 20 69 66 20 74 68 65  79 20 63 6f 6e 74 61 69  |s if they contai|
00000270  6e 20 61 6e 79 0a 73 70  61 63 65 73 2e 0a 0a 45  |n any.spaces...E|
00000280  78 61 6d 70 6c 65 73 0a  0a 20 20 41 70 70 45 6e  |xamples..  AppEn|
00000290  73 75 72 65 20 22 43 44  20 50 6c 61 79 65 72 22  |sure "CD Player"|
000002a0  20 22 46 69 6c 65 72 5f  72 75 6e 20 3c 41 75 64  | "Filer_run <Aud|
000002b0  69 6f 50 61 6e 65 6c 24  64 69 72 3e 22 0a 20 20  |ioPanel$dir>".  |
000002c0  41 70 70 45 6e 73 75 72  65 20 45 64 69 74 20 22  |AppEnsure Edit "|
000002d0  46 69 6c 65 72 5f 72 75  6e 20 3c 45 64 69 74 24  |Filer_run <Edit$|
000002e0  64 69 72 3e 22 0a 0a 56  69 72 74 75 61 6c 6c 79  |dir>"..Virtually|
000002f0  20 61 6c 6c 20 61 70 70  6c 69 63 61 74 69 6f 6e  | all application|
00000300  73 20 73 65 74 20 75 70  20 61 6e 20 6f 70 65 72  |s set up an oper|
00000310  61 74 69 6e 67 20 73 79  73 74 65 6d 20 76 61 72  |ating system var|
00000320  69 61 62 6c 65 20 74 6f  20 72 65 63 6f 72 64 0a  |iable to record.|
00000330  77 68 65 72 65 20 74 68  65 79 20 61 72 65 2e 20  |where they are. |
00000340  20 54 68 69 73 2c 20 75  73 65 64 20 77 69 74 68  | This, used with|
00000350  20 46 69 6c 65 72 5f 72  75 6e 2c 20 69 73 20 74  | Filer_run, is t|
00000360  68 65 20 62 65 73 74 20  77 61 79 20 74 6f 20 73  |he best way to s|
00000370  74 61 72 74 20 74 68 65  6d 20 75 70 2e 20 0a 55  |tart them up. .U|
00000380  73 75 61 6c 6c 79 20 69  74 20 69 73 20 70 72 65  |sually it is pre|
00000390  74 74 79 20 6f 62 76 69  6f 75 73 20 77 68 61 74  |tty obvious what|
000003a0  20 69 74 20 69 73 20 6c  69 6b 65 6c 79 20 74 6f  | it is likely to|
000003b0  20 62 65 20 63 61 6c 6c  65 64 2c 20 65 67 20 45  | be called, eg E|
000003c0  64 69 74 24 64 69 72 2c  20 0a 62 75 74 20 77 69  |dit$dir, .but wi|
000003d0  74 68 20 6f 74 68 65 72  73 2c 20 65 67 20 43 44  |th others, eg CD|
000003e0  20 50 6c 61 79 65 72 20  79 6f 75 20 77 69 6c 6c  | Player you will|
000003f0  20 6e 65 65 64 20 74 6f  20 6c 6f 6f 6b 20 69 6e  | need to look in|
00000400  20 74 68 65 20 21 62 6f  6f 74 20 61 6e 64 2f 6f  | the !boot and/o|
00000410  72 20 21 72 75 6e 0a 66  69 6c 65 28 73 29 20 74  |r !run.file(s) t|
00000420  6f 20 66 69 6e 64 20 6f  75 74 2e 20 20 49 66 20  |o find out.  If |
00000430  74 68 65 72 65 20 69 73  6e 27 74 20 61 20 73 75  |there isn't a su|
00000440  69 74 61 62 6c 65 20 73  79 73 74 65 6d 20 76 61  |itable system va|
00000450  72 69 61 62 6c 65 2c 20  74 68 65 6e 20 65 69 74  |riable, then eit|
00000460  68 65 72 0a 75 73 65 20  74 68 65 20 66 75 6c 6c  |her.use the full|
00000470  20 70 61 74 68 20 6e 61  6d 65 20 6f 66 20 74 68  | path name of th|
00000480  65 20 61 70 70 6c 69 63  61 74 69 6f 6e 2c 20 6f  |e application, o|
00000490  72 20 61 64 64 20 61 20  73 75 69 74 61 62 6c 65  |r add a suitable|
000004a0  20 73 79 73 74 65 6d 20  76 61 72 69 61 62 6c 65  | system variable|
000004b0  0a 74 6f 20 42 4f 54 48  20 74 68 65 20 61 70 70  |.to BOTH the app|
000004c0  6c 69 63 61 74 69 6f 6e  73 20 21 62 6f 6f 74 20  |lications !boot |
000004d0  66 69 6c 65 20 41 4e 44  20 69 74 73 20 21 72 75  |file AND its !ru|
000004e0  6e 20 66 69 6c 65 2e 20  20 28 49 66 20 74 68 65  |n file.  (If the|
000004f0  20 21 72 75 6e 20 66 69  6c 65 0a 65 78 65 63 75  | !run file.execu|
00000500  74 65 73 20 74 68 65 20  21 62 6f 6f 74 20 66 69  |tes the !boot fi|
00000510  6c 65 20 74 68 65 6e 20  69 74 20 69 73 20 6f 6e  |le then it is on|
00000520  6c 79 20 6e 65 65 64 65  64 20 69 6e 20 74 68 65  |ly needed in the|
00000530  20 21 62 6f 6f 74 20 66  69 6c 65 29 2e 0a        | !boot file)..|
0000053e