Home » Archimedes archive » Acorn User » AU 1996-12 B.adf » Regulars_2 » StarInfo/Clifford/!Macros/Documents/MacroCode

StarInfo/Clifford/!Macros/Documents/MacroCode

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-12 B.adf » Regulars_2
Filename: StarInfo/Clifford/!Macros/Documents/MacroCode
Read OK:
File size: 078F bytes
Load address: 0000
Exec address: 0000
File contents
Macro code files
================

The following macro code modules should be supplied:
	CDcontrol
	FKey
	InsertText
	LoseCaret
	ReadIcon
	SetCSD
	Watchdog
Sources for all of these can be found in the MacroCode.s directory.


CDcontrol
---------

This provides simple control over the playing of audio CDs, and
performs different actions depending on the parameter supplied:
	0 : Play CD from the first track
	1 : Stop playing
	2 : Move to the previous track
	3 : Move to the following track
	4 : Eject the CD


InsertText
----------

This behaves in the same manner as *Echo, but instead of printing the
output, it places it in the keyboard buffer, making it appear that the
text has been typed in by the user. Be careful when attaching this
module to keys such as ctrl, because this has the effect of changing
every character entered into ctrl+<character> which is not usually
desirable.

Note: Although InsertText can handle strings of an unlimited (except
by memory) length, the keyboard buffer can only accept 256 characters
at a time, so there is, in practice, a maximum limit of 256 characters
that may be entered at once by this means.


LoseCaret
---------

This will remove the caret (usually a red I bar) from anything
currently owning it, allowing keypresses to circulate further through
the desktop.


ReadIcon
--------

This attempts to read the text underneath the pointer, and will store
it in the system variable Icon$Text if it was successful.


SetCSD
------

If the window underneath the pointer is recognised as belonging to the
Filer, then the current directory is set to the path in the window
title. This has the same affect as the ctrl+tab keypresses supplied by
Menon and Director.


Watchdog
--------

Risc OS 3.11 and earlier have no standard means of killing tasks that
hang the machine. This module will bring up an error box, asking if
you wish to kill the current task, and will do so if you choose OK.
00000000  4d 61 63 72 6f 20 63 6f  64 65 20 66 69 6c 65 73  |Macro code files|
00000010  0a 3d 3d 3d 3d 3d 3d 3d  3d 3d 3d 3d 3d 3d 3d 3d  |.===============|
00000020  3d 0a 0a 54 68 65 20 66  6f 6c 6c 6f 77 69 6e 67  |=..The following|
00000030  20 6d 61 63 72 6f 20 63  6f 64 65 20 6d 6f 64 75  | macro code modu|
00000040  6c 65 73 20 73 68 6f 75  6c 64 20 62 65 20 73 75  |les should be su|
00000050  70 70 6c 69 65 64 3a 0a  09 43 44 63 6f 6e 74 72  |pplied:..CDcontr|
00000060  6f 6c 0a 09 46 4b 65 79  0a 09 49 6e 73 65 72 74  |ol..FKey..Insert|
00000070  54 65 78 74 0a 09 4c 6f  73 65 43 61 72 65 74 0a  |Text..LoseCaret.|
00000080  09 52 65 61 64 49 63 6f  6e 0a 09 53 65 74 43 53  |.ReadIcon..SetCS|
00000090  44 0a 09 57 61 74 63 68  64 6f 67 0a 53 6f 75 72  |D..Watchdog.Sour|
000000a0  63 65 73 20 66 6f 72 20  61 6c 6c 20 6f 66 20 74  |ces for all of t|
000000b0  68 65 73 65 20 63 61 6e  20 62 65 20 66 6f 75 6e  |hese can be foun|
000000c0  64 20 69 6e 20 74 68 65  20 4d 61 63 72 6f 43 6f  |d in the MacroCo|
000000d0  64 65 2e 73 20 64 69 72  65 63 74 6f 72 79 2e 0a  |de.s directory..|
000000e0  0a 0a 43 44 63 6f 6e 74  72 6f 6c 0a 2d 2d 2d 2d  |..CDcontrol.----|
000000f0  2d 2d 2d 2d 2d 0a 0a 54  68 69 73 20 70 72 6f 76  |-----..This prov|
00000100  69 64 65 73 20 73 69 6d  70 6c 65 20 63 6f 6e 74  |ides simple cont|
00000110  72 6f 6c 20 6f 76 65 72  20 74 68 65 20 70 6c 61  |rol over the pla|
00000120  79 69 6e 67 20 6f 66 20  61 75 64 69 6f 20 43 44  |ying of audio CD|
00000130  73 2c 20 61 6e 64 0a 70  65 72 66 6f 72 6d 73 20  |s, and.performs |
00000140  64 69 66 66 65 72 65 6e  74 20 61 63 74 69 6f 6e  |different action|
00000150  73 20 64 65 70 65 6e 64  69 6e 67 20 6f 6e 20 74  |s depending on t|
00000160  68 65 20 70 61 72 61 6d  65 74 65 72 20 73 75 70  |he parameter sup|
00000170  70 6c 69 65 64 3a 0a 09  30 20 3a 20 50 6c 61 79  |plied:..0 : Play|
00000180  20 43 44 20 66 72 6f 6d  20 74 68 65 20 66 69 72  | CD from the fir|
00000190  73 74 20 74 72 61 63 6b  0a 09 31 20 3a 20 53 74  |st track..1 : St|
000001a0  6f 70 20 70 6c 61 79 69  6e 67 0a 09 32 20 3a 20  |op playing..2 : |
000001b0  4d 6f 76 65 20 74 6f 20  74 68 65 20 70 72 65 76  |Move to the prev|
000001c0  69 6f 75 73 20 74 72 61  63 6b 0a 09 33 20 3a 20  |ious track..3 : |
000001d0  4d 6f 76 65 20 74 6f 20  74 68 65 20 66 6f 6c 6c  |Move to the foll|
000001e0  6f 77 69 6e 67 20 74 72  61 63 6b 0a 09 34 20 3a  |owing track..4 :|
000001f0  20 45 6a 65 63 74 20 74  68 65 20 43 44 0a 0a 0a  | Eject the CD...|
00000200  49 6e 73 65 72 74 54 65  78 74 0a 2d 2d 2d 2d 2d  |InsertText.-----|
00000210  2d 2d 2d 2d 2d 0a 0a 54  68 69 73 20 62 65 68 61  |-----..This beha|
00000220  76 65 73 20 69 6e 20 74  68 65 20 73 61 6d 65 20  |ves in the same |
00000230  6d 61 6e 6e 65 72 20 61  73 20 2a 45 63 68 6f 2c  |manner as *Echo,|
00000240  20 62 75 74 20 69 6e 73  74 65 61 64 20 6f 66 20  | but instead of |
00000250  70 72 69 6e 74 69 6e 67  20 74 68 65 0a 6f 75 74  |printing the.out|
00000260  70 75 74 2c 20 69 74 20  70 6c 61 63 65 73 20 69  |put, it places i|
00000270  74 20 69 6e 20 74 68 65  20 6b 65 79 62 6f 61 72  |t in the keyboar|
00000280  64 20 62 75 66 66 65 72  2c 20 6d 61 6b 69 6e 67  |d buffer, making|
00000290  20 69 74 20 61 70 70 65  61 72 20 74 68 61 74 20  | it appear that |
000002a0  74 68 65 0a 74 65 78 74  20 68 61 73 20 62 65 65  |the.text has bee|
000002b0  6e 20 74 79 70 65 64 20  69 6e 20 62 79 20 74 68  |n typed in by th|
000002c0  65 20 75 73 65 72 2e 20  42 65 20 63 61 72 65 66  |e user. Be caref|
000002d0  75 6c 20 77 68 65 6e 20  61 74 74 61 63 68 69 6e  |ul when attachin|
000002e0  67 20 74 68 69 73 0a 6d  6f 64 75 6c 65 20 74 6f  |g this.module to|
000002f0  20 6b 65 79 73 20 73 75  63 68 20 61 73 20 63 74  | keys such as ct|
00000300  72 6c 2c 20 62 65 63 61  75 73 65 20 74 68 69 73  |rl, because this|
00000310  20 68 61 73 20 74 68 65  20 65 66 66 65 63 74 20  | has the effect |
00000320  6f 66 20 63 68 61 6e 67  69 6e 67 0a 65 76 65 72  |of changing.ever|
00000330  79 20 63 68 61 72 61 63  74 65 72 20 65 6e 74 65  |y character ente|
00000340  72 65 64 20 69 6e 74 6f  20 63 74 72 6c 2b 3c 63  |red into ctrl+<c|
00000350  68 61 72 61 63 74 65 72  3e 20 77 68 69 63 68 20  |haracter> which |
00000360  69 73 20 6e 6f 74 20 75  73 75 61 6c 6c 79 0a 64  |is not usually.d|
00000370  65 73 69 72 61 62 6c 65  2e 0a 0a 4e 6f 74 65 3a  |esirable...Note:|
00000380  20 41 6c 74 68 6f 75 67  68 20 49 6e 73 65 72 74  | Although Insert|
00000390  54 65 78 74 20 63 61 6e  20 68 61 6e 64 6c 65 20  |Text can handle |
000003a0  73 74 72 69 6e 67 73 20  6f 66 20 61 6e 20 75 6e  |strings of an un|
000003b0  6c 69 6d 69 74 65 64 20  28 65 78 63 65 70 74 0a  |limited (except.|
000003c0  62 79 20 6d 65 6d 6f 72  79 29 20 6c 65 6e 67 74  |by memory) lengt|
000003d0  68 2c 20 74 68 65 20 6b  65 79 62 6f 61 72 64 20  |h, the keyboard |
000003e0  62 75 66 66 65 72 20 63  61 6e 20 6f 6e 6c 79 20  |buffer can only |
000003f0  61 63 63 65 70 74 20 32  35 36 20 63 68 61 72 61  |accept 256 chara|
00000400  63 74 65 72 73 0a 61 74  20 61 20 74 69 6d 65 2c  |cters.at a time,|
00000410  20 73 6f 20 74 68 65 72  65 20 69 73 2c 20 69 6e  | so there is, in|
00000420  20 70 72 61 63 74 69 63  65 2c 20 61 20 6d 61 78  | practice, a max|
00000430  69 6d 75 6d 20 6c 69 6d  69 74 20 6f 66 20 32 35  |imum limit of 25|
00000440  36 20 63 68 61 72 61 63  74 65 72 73 0a 74 68 61  |6 characters.tha|
00000450  74 20 6d 61 79 20 62 65  20 65 6e 74 65 72 65 64  |t may be entered|
00000460  20 61 74 20 6f 6e 63 65  20 62 79 20 74 68 69 73  | at once by this|
00000470  20 6d 65 61 6e 73 2e 0a  0a 0a 4c 6f 73 65 43 61  | means....LoseCa|
00000480  72 65 74 0a 2d 2d 2d 2d  2d 2d 2d 2d 2d 0a 0a 54  |ret.---------..T|
00000490  68 69 73 20 77 69 6c 6c  20 72 65 6d 6f 76 65 20  |his will remove |
000004a0  74 68 65 20 63 61 72 65  74 20 28 75 73 75 61 6c  |the caret (usual|
000004b0  6c 79 20 61 20 72 65 64  20 49 20 62 61 72 29 20  |ly a red I bar) |
000004c0  66 72 6f 6d 20 61 6e 79  74 68 69 6e 67 0a 63 75  |from anything.cu|
000004d0  72 72 65 6e 74 6c 79 20  6f 77 6e 69 6e 67 20 69  |rrently owning i|
000004e0  74 2c 20 61 6c 6c 6f 77  69 6e 67 20 6b 65 79 70  |t, allowing keyp|
000004f0  72 65 73 73 65 73 20 74  6f 20 63 69 72 63 75 6c  |resses to circul|
00000500  61 74 65 20 66 75 72 74  68 65 72 20 74 68 72 6f  |ate further thro|
00000510  75 67 68 0a 74 68 65 20  64 65 73 6b 74 6f 70 2e  |ugh.the desktop.|
00000520  0a 0a 0a 52 65 61 64 49  63 6f 6e 0a 2d 2d 2d 2d  |...ReadIcon.----|
00000530  2d 2d 2d 2d 0a 0a 54 68  69 73 20 61 74 74 65 6d  |----..This attem|
00000540  70 74 73 20 74 6f 20 72  65 61 64 20 74 68 65 20  |pts to read the |
00000550  74 65 78 74 20 75 6e 64  65 72 6e 65 61 74 68 20  |text underneath |
00000560  74 68 65 20 70 6f 69 6e  74 65 72 2c 20 61 6e 64  |the pointer, and|
00000570  20 77 69 6c 6c 20 73 74  6f 72 65 0a 69 74 20 69  | will store.it i|
00000580  6e 20 74 68 65 20 73 79  73 74 65 6d 20 76 61 72  |n the system var|
00000590  69 61 62 6c 65 20 49 63  6f 6e 24 54 65 78 74 20  |iable Icon$Text |
000005a0  69 66 20 69 74 20 77 61  73 20 73 75 63 63 65 73  |if it was succes|
000005b0  73 66 75 6c 2e 0a 0a 0a  53 65 74 43 53 44 0a 2d  |sful....SetCSD.-|
000005c0  2d 2d 2d 2d 2d 0a 0a 49  66 20 74 68 65 20 77 69  |-----..If the wi|
000005d0  6e 64 6f 77 20 75 6e 64  65 72 6e 65 61 74 68 20  |ndow underneath |
000005e0  74 68 65 20 70 6f 69 6e  74 65 72 20 69 73 20 72  |the pointer is r|
000005f0  65 63 6f 67 6e 69 73 65  64 20 61 73 20 62 65 6c  |ecognised as bel|
00000600  6f 6e 67 69 6e 67 20 74  6f 20 74 68 65 0a 46 69  |onging to the.Fi|
00000610  6c 65 72 2c 20 74 68 65  6e 20 74 68 65 20 63 75  |ler, then the cu|
00000620  72 72 65 6e 74 20 64 69  72 65 63 74 6f 72 79 20  |rrent directory |
00000630  69 73 20 73 65 74 20 74  6f 20 74 68 65 20 70 61  |is set to the pa|
00000640  74 68 20 69 6e 20 74 68  65 20 77 69 6e 64 6f 77  |th in the window|
00000650  0a 74 69 74 6c 65 2e 20  54 68 69 73 20 68 61 73  |.title. This has|
00000660  20 74 68 65 20 73 61 6d  65 20 61 66 66 65 63 74  | the same affect|
00000670  20 61 73 20 74 68 65 20  63 74 72 6c 2b 74 61 62  | as the ctrl+tab|
00000680  20 6b 65 79 70 72 65 73  73 65 73 20 73 75 70 70  | keypresses supp|
00000690  6c 69 65 64 20 62 79 0a  4d 65 6e 6f 6e 20 61 6e  |lied by.Menon an|
000006a0  64 20 44 69 72 65 63 74  6f 72 2e 0a 0a 0a 57 61  |d Director....Wa|
000006b0  74 63 68 64 6f 67 0a 2d  2d 2d 2d 2d 2d 2d 2d 0a  |tchdog.--------.|
000006c0  0a 52 69 73 63 20 4f 53  20 33 2e 31 31 20 61 6e  |.Risc OS 3.11 an|
000006d0  64 20 65 61 72 6c 69 65  72 20 68 61 76 65 20 6e  |d earlier have n|
000006e0  6f 20 73 74 61 6e 64 61  72 64 20 6d 65 61 6e 73  |o standard means|
000006f0  20 6f 66 20 6b 69 6c 6c  69 6e 67 20 74 61 73 6b  | of killing task|
00000700  73 20 74 68 61 74 0a 68  61 6e 67 20 74 68 65 20  |s that.hang the |
00000710  6d 61 63 68 69 6e 65 2e  20 54 68 69 73 20 6d 6f  |machine. This mo|
00000720  64 75 6c 65 20 77 69 6c  6c 20 62 72 69 6e 67 20  |dule will bring |
00000730  75 70 20 61 6e 20 65 72  72 6f 72 20 62 6f 78 2c  |up an error box,|
00000740  20 61 73 6b 69 6e 67 20  69 66 0a 79 6f 75 20 77  | asking if.you w|
00000750  69 73 68 20 74 6f 20 6b  69 6c 6c 20 74 68 65 20  |ish to kill the |
00000760  63 75 72 72 65 6e 74 20  74 61 73 6b 2c 20 61 6e  |current task, an|
00000770  64 20 77 69 6c 6c 20 64  6f 20 73 6f 20 69 66 20  |d will do so if |
00000780  79 6f 75 20 63 68 6f 6f  73 65 20 4f 4b 2e 0a     |you choose OK..|
0000078f