Home » Archimedes archive » Acorn User » AU 1996-08.adf » Regulars » StarInfo/Kemp/TaskEnsure/Examples
StarInfo/Kemp/TaskEnsure/Examples
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/Kemp/TaskEnsure/Examples |
Read OK: | ✔ |
File size: | 06DE bytes |
Load address: | 0000 |
Exec address: | 0000 |
File contents
| ---------------------------------------------------------------------------- | Examples | | Demonstrates the TaskEnsure utility | | by KCE Software (Andrew Kemp) | | � March 1996 | | ---------------------------------------------------------------------------- | ---------------------------------------------------------------------------- | Check to see if Chars and Draw are active, and run them if they aren't | - note that in these cases the task name can either be in quotes or | not, as you prefer. | | WimpTask is being used here (rather than just 'Run') so that this Obey | file will continue to execute after the command does. | ---------------------------------------------------------------------------- TaskEnsure Characters WimpTask Resources:$.Apps.!Chars TaskEnsure "Draw" WimpTask Resources:$.Apps.!Draw | ---------------------------------------------------------------------------- | Check to see if Paint is active, and load a sprite file into it if so. | | Demonstrates how to invert the condition for executing the command. | ---------------------------------------------------------------------------- Set Paint$Active TRUE TaskEnsure Paint Set Paint$Active FALSE If "<Paint$Active>" = "TRUE" then filer_run Resources:$.Resources.Wimp.Sprites Unset Paint$Active | ---------------------------------------------------------------------------- | Throw an error if a given (fictional in this case) task is not active. | | Demonstrates use of spaces in the task name - the quotes are required | this time. | ---------------------------------------------------------------------------- TaskEnsure "Fake Task" Error Task 'Fake Task' not active
00000000 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d || --------------| 00000010 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000040 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 7c |--------------.|| 00000050 20 20 20 20 20 20 20 45 78 61 6d 70 6c 65 73 0a | Examples.| 00000060 7c 0a 7c 20 20 20 20 20 20 20 44 65 6d 6f 6e 73 ||.| Demons| 00000070 74 72 61 74 65 73 20 74 68 65 20 54 61 73 6b 45 |trates the TaskE| 00000080 6e 73 75 72 65 20 75 74 69 6c 69 74 79 0a 7c 0a |nsure utility.|.| 00000090 7c 20 20 20 20 20 20 20 62 79 20 4b 43 45 20 53 || by KCE S| 000000a0 6f 66 74 77 61 72 65 20 28 41 6e 64 72 65 77 20 |oftware (Andrew | 000000b0 4b 65 6d 70 29 0a 7c 0a 7c 20 20 20 20 20 20 20 |Kemp).|.| | 000000c0 a9 20 4d 61 72 63 68 20 31 39 39 36 0a 7c 0a 7c |. March 1996.|.|| 000000d0 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ---------------| 000000e0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000110 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 0a 7c |-------------..|| 00000120 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d | ---------------| 00000130 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000160 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 0a 7c 20 |-------------.| | 00000170 20 20 20 20 20 20 43 68 65 63 6b 20 74 6f 20 73 | Check to s| 00000180 65 65 20 69 66 20 43 68 61 72 73 20 61 6e 64 20 |ee if Chars and | 00000190 44 72 61 77 20 61 72 65 20 61 63 74 69 76 65 2c |Draw are active,| 000001a0 20 61 6e 64 20 72 75 6e 20 74 68 65 6d 20 69 66 | and run them if| 000001b0 20 74 68 65 79 20 61 72 65 6e 27 74 0a 7c 20 20 | they aren't.| | 000001c0 20 20 20 20 20 2d 20 6e 6f 74 65 20 74 68 61 74 | - note that| 000001d0 20 69 6e 20 74 68 65 73 65 20 63 61 73 65 73 20 | in these cases | 000001e0 74 68 65 20 74 61 73 6b 20 6e 61 6d 65 20 63 61 |the task name ca| 000001f0 6e 20 65 69 74 68 65 72 20 62 65 20 69 6e 20 71 |n either be in q| 00000200 75 6f 74 65 73 20 6f 72 0a 7c 20 20 20 20 20 20 |uotes or.| | 00000210 20 6e 6f 74 2c 20 61 73 20 79 6f 75 20 70 72 65 | not, as you pre| 00000220 66 65 72 2e 0a 7c 0a 7c 20 20 20 20 20 20 20 57 |fer..|.| W| 00000230 69 6d 70 54 61 73 6b 20 69 73 20 62 65 69 6e 67 |impTask is being| 00000240 20 75 73 65 64 20 68 65 72 65 20 28 72 61 74 68 | used here (rath| 00000250 65 72 20 74 68 61 6e 20 6a 75 73 74 20 27 52 75 |er than just 'Ru| 00000260 6e 27 29 20 73 6f 20 74 68 61 74 20 74 68 69 73 |n') so that this| 00000270 20 4f 62 65 79 0a 7c 20 20 20 20 20 20 20 66 69 | Obey.| fi| 00000280 6c 65 20 77 69 6c 6c 20 63 6f 6e 74 69 6e 75 65 |le will continue| 00000290 20 74 6f 20 65 78 65 63 75 74 65 20 61 66 74 65 | to execute afte| 000002a0 72 20 74 68 65 20 63 6f 6d 6d 61 6e 64 20 64 6f |r the command do| 000002b0 65 73 2e 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |es..| ----------| 000002c0 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 00000300 2d 2d 0a 0a 54 61 73 6b 45 6e 73 75 72 65 20 43 |--..TaskEnsure C| 00000310 68 61 72 61 63 74 65 72 73 20 20 20 57 69 6d 70 |haracters Wimp| 00000320 54 61 73 6b 20 52 65 73 6f 75 72 63 65 73 3a 24 |Task Resources:$| 00000330 2e 41 70 70 73 2e 21 43 68 61 72 73 0a 54 61 73 |.Apps.!Chars.Tas| 00000340 6b 45 6e 73 75 72 65 20 22 44 72 61 77 22 20 20 |kEnsure "Draw" | 00000350 20 20 20 20 20 57 69 6d 70 54 61 73 6b 20 52 65 | WimpTask Re| 00000360 73 6f 75 72 63 65 73 3a 24 2e 41 70 70 73 2e 21 |sources:$.Apps.!| 00000370 44 72 61 77 0a 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d |Draw..| --------| 00000380 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000003c0 2d 2d 2d 2d 0a 7c 20 20 20 20 20 20 20 43 68 65 |----.| Che| 000003d0 63 6b 20 74 6f 20 73 65 65 20 69 66 20 50 61 69 |ck to see if Pai| 000003e0 6e 74 20 69 73 20 61 63 74 69 76 65 2c 20 61 6e |nt is active, an| 000003f0 64 20 6c 6f 61 64 20 61 20 73 70 72 69 74 65 20 |d load a sprite | 00000400 66 69 6c 65 20 69 6e 74 6f 20 69 74 20 69 66 20 |file into it if | 00000410 73 6f 2e 0a 7c 0a 7c 20 20 20 20 20 20 20 44 65 |so..|.| De| 00000420 6d 6f 6e 73 74 72 61 74 65 73 20 68 6f 77 20 74 |monstrates how t| 00000430 6f 20 69 6e 76 65 72 74 20 74 68 65 20 63 6f 6e |o invert the con| 00000440 64 69 74 69 6f 6e 20 66 6f 72 20 65 78 65 63 75 |dition for execu| 00000450 74 69 6e 67 20 74 68 65 20 63 6f 6d 6d 61 6e 64 |ting the command| 00000460 2e 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |..| ------------| 00000470 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000004b0 0a 0a 53 65 74 20 50 61 69 6e 74 24 41 63 74 69 |..Set Paint$Acti| 000004c0 76 65 20 54 52 55 45 0a 54 61 73 6b 45 6e 73 75 |ve TRUE.TaskEnsu| 000004d0 72 65 20 50 61 69 6e 74 20 53 65 74 20 50 61 69 |re Paint Set Pai| 000004e0 6e 74 24 41 63 74 69 76 65 20 46 41 4c 53 45 0a |nt$Active FALSE.| 000004f0 49 66 20 22 3c 50 61 69 6e 74 24 41 63 74 69 76 |If "<Paint$Activ| 00000500 65 3e 22 20 3d 20 22 54 52 55 45 22 20 74 68 65 |e>" = "TRUE" the| 00000510 6e 20 66 69 6c 65 72 5f 72 75 6e 20 52 65 73 6f |n filer_run Reso| 00000520 75 72 63 65 73 3a 24 2e 52 65 73 6f 75 72 63 65 |urces:$.Resource| 00000530 73 2e 57 69 6d 70 2e 53 70 72 69 74 65 73 0a 55 |s.Wimp.Sprites.U| 00000540 6e 73 65 74 20 50 61 69 6e 74 24 41 63 74 69 76 |nset Paint$Activ| 00000550 65 0a 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |e..| -----------| 00000560 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000005a0 2d 0a 7c 20 20 20 20 20 20 20 54 68 72 6f 77 20 |-.| Throw | 000005b0 61 6e 20 65 72 72 6f 72 20 69 66 20 61 20 67 69 |an error if a gi| 000005c0 76 65 6e 20 28 66 69 63 74 69 6f 6e 61 6c 20 69 |ven (fictional i| 000005d0 6e 20 74 68 69 73 20 63 61 73 65 29 20 74 61 73 |n this case) tas| 000005e0 6b 20 69 73 20 6e 6f 74 20 61 63 74 69 76 65 2e |k is not active.| 000005f0 0a 7c 0a 7c 20 20 20 20 20 20 20 44 65 6d 6f 6e |.|.| Demon| 00000600 73 74 72 61 74 65 73 20 75 73 65 20 6f 66 20 73 |strates use of s| 00000610 70 61 63 65 73 20 69 6e 20 74 68 65 20 74 61 73 |paces in the tas| 00000620 6b 20 6e 61 6d 65 20 2d 20 74 68 65 20 71 75 6f |k name - the quo| 00000630 74 65 73 20 61 72 65 20 72 65 71 75 69 72 65 64 |tes are required| 00000640 0a 7c 20 20 20 20 20 20 20 74 68 69 73 20 74 69 |.| this ti| 00000650 6d 65 2e 0a 7c 20 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |me..| ----------| 00000660 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d 2d |----------------| * 000006a0 2d 2d 0a 0a 54 61 73 6b 45 6e 73 75 72 65 20 22 |--..TaskEnsure "| 000006b0 46 61 6b 65 20 54 61 73 6b 22 20 20 45 72 72 6f |Fake Task" Erro| 000006c0 72 20 54 61 73 6b 20 27 46 61 6b 65 20 54 61 73 |r Task 'Fake Tas| 000006d0 6b 27 20 6e 6f 74 20 61 63 74 69 76 65 0a |k' not active.| 000006de