Masterclass Keep you Amiga waiting about and make you life easier. Recently I found myself in the situation where I really needed to start a program running on my Amiga even though I wasn't about. I was re-rendering a large animation which I can created with Imagine using AdPro and Fred (a must under-used system if ever there was one), and when it was finished I need to combine the results into a ANIM7 file. If you remember, ANIM7 files are like normal Amiga IFF animations except they are a lot faster if you have a 68020 or better. The excellent Viewtek program comes with the utility MakeAnim7 which will happily take a standard file and process it into ANIM7 format. Anyway, the AdPro/Fred process was still churning away making 24 bit frames into HAM8 frames and doing a little post-production, and I had to nip home for tea. I knew the process would finish in an hour or so, but I couldn't wait around to start the MakeAnim7 program. And although the Amiga is multitasking, I couldn't start the MakeAnim7 going because it needed to use the files which wouldn't exist until the AdPro/Fred process was complete. I needed a way of delaying starting the MakeAnim7 program for a few hours, so that when I came in to the office next morning the files would be waiting for me. That's when I remember the AmigaDOS "wait" command. Wait does exactly what you would expect it to: nothing. It simply sits there doing nothing (not wasting processor power) until it gets bored. You can therefore use it to delay a process for starting. Open a Shell and enter: wait 10 secs and you'll see that wait well, waits. You can also use the following format wait 1 min 10 secs for waiting longer times. Therefore, you could write a script which looked like the following. Remember a script is nothing more complicated than a text file, created with ED or some other text editor. wait 120 min makeanim7 hd3:house.anim Now with this script saved to disk under the name "Zzz" I could open a shell and enter: execute Zzz and then nip home for tea. When two hours had passed the script would move unto the MakeAnim7 part, by which time AdPro/Fred would be finished. You can also ask wait to keep waiting until a specific time. For example, enter "date" into the shell and make a note of the time. Quickly add a few seconds and enter: wait until 16:12 or whatever the time is. The process will freeze until the time passes. Note that this is startlingly accurate, but it is certainly good enough for simply delaying the process. This got me thinking, because sometimes I get a bit wary about leaving the Amiga working all night on something important. If something has gone wrong, I would like to know about it. The problem is that the Amiga is in an office several miles away, and I don't want to keep driving there to look through the window. Well, thanks to modern technology I don't have to any more. My Amiga happens to have a modem attached to it, and by using ARexx to control a comms program, I can write a program which actually dials up my home number. Now you need to be really careful debugging programs like this: and one of the first things to check is that it will dial the right number every single time. The second thing is to check that the modem will be correctly disconnected without leaving the line off the hook. The set-up is something like this: an AmigaDOS script waits until a certain time. It then runs an ARexx program. The ARexx program does a little work to calculate the last image rendered, or how much free disk space is free: something that lets me know all is OK. It then uses the ARexx port on the terminal emulator program "Term", and instructs it to dial my house. The script checks for an engaged tone, and also checks that the line doesn't keep ringing indefinitely. This is where things start to go wrong however, as try as I might, I really can't understand a modem talking to me at V34 28,800 bps. The original plan was to connect some form of speech synthesiser, perhaps using the old Workbench 1.3 Amiga SAY command. This could therefore ring me up at 10 o'clock in the evening and say "Hello master, last frame rendered was 1040". It could also ring me up first thing in the morning and tell me to get out of bed. However, connecting a speed synthesiser to the modem is starting to get a bit tricky. Instead the modem dials my number and lets it ring only once. This lets me know that the next call is from the computer, and I shouldn't answer it. The program then redials me, and depending on the number of rings informs me of the current status. Three rings means everything is ok, six means something is wrong. Get the idea. Best of all, as I don't answer the call I finally get to use BT's service for free. The script used to dial up my number looks something like this: /* Dial me up! */ address term OPTIONS RESULTS Say "Wake up modem..." send 'atz\r\n' wait 'OK' say "Dialing..." send "atdt\r" TIMEOUT SEC 20 CLEAR wait ADDITEM TO wait NAME 'BUSY' ADDITEM TO wait NAME 'RINGING' wait IF rc ~= 0 THEN SAY 'no text was received from modem' ELSE do SAY result say "I know the telephone is ringing or busy" end if result = 'BUSY' then do say "The line is busy, so exit." hangup exit end if result = 'RINGING' then say "I know it is ringing.." /* We can tell if the call is answered only if the RINGING signal does not happen again with a few seconds... */ max_rings = 3 rings=0 do while (rc=0 & rings