home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format 25 / af025.adf / fortunes_readme (.png) < prev    next >
ANSI Art File  |  1991-06-14  |  10KB  |  640x3792
Labels: text | screenshot | font
OCR: The F Fortune AbORTE Program ) J. Finis I hate writing docs, but here goes .. . . Having "grown up" on big UNIX machines, I missed a lot of the fun features of these machines when I started using my Amiga. One of these was the Fortune program, which prints out a random text from a (usually huge) file. I wrote my own version, with a few(!) extra features : It can open a window on the workbench screen; It can be "iconised" out of the way, and then called up again later; 0 The text file is compressed, and contains a special "jump table" so fortunes can be read very quickly, no matter how big the file; The window can be used with any font; O The fortune can be printed out or even spoken with the narrator; n It can be run from the Workbench; 0 It works under Workbench 2.0. A small fortune data file is provided, as well as a program for turning ordinary text files into a compressed fortune data file with a jump table. You can read about this later on. I myself have a file with over 1900 fortunes in it, which is 240K of data! But then I also have a hard disk. .. Using the Fortune program The program can be run from either the Workbench or the CLI. First, the Workbench. You can easily run the program just by double-clicking on its icon. It normally looks for a data file called "fortunes" in the same directory, but you can change this if you want to (see the bit about Tool Types later on). That's the easiest way to use it. Another way, which is useful if you have more than one data file and you want to get a fortune from a particular one, is to double-click on the icon for that data file. This icon looks like a smaller version of the fortune program's icon, but has the word "data" written in it. The "makefort" program automatically makes this icon for you when you make a fortune data file. If you use this method, the fortune program must be in the same directory. The Fortune Window A window should open, with a fortune printed inside it. Laugh, or ponder, and then either click on the close gadget to quit the program, or press one of the keys below. If you wait for a bit (usually about six seconds, but you can change it), it will show another fortune, but only if you keep the window active. This means you can pause to read a long fortune by clicking in another window. The keys The 'q' key This will quit the program, just like clicking on the close gadget. The 's' key This will speak the fortune, and then go on to show another one. The 'p' key This will print the fortune, and show another one. The 'l' key After you press this key, all subsequent fortunes will be more than seven lines long. Since there are less of these fortunes, it may take the program a few seconds to find one for you. Pressing ' l' again restores normality. : 'i' key Pressing this key 'iconises' the fortune window to be a small bar, which you can keep somewhere out of the way on your workbench, until you feel the urge for another fortune. You can then press again to get the full-sized window. Other keys Pressing any other key will tell the program to get another fortune from the file and show it. Tool Types Using the "Info" option from the Workbench's menu, you can change a few things about the fortune program. First, click on the icon for the program (not the data file), and select "Info" from the menu. You can then add, or modify, the tool types. When you have finished, select "save". The tool types are: FONT You can set the font the fortune is printed in by adding a tool type of the form FONT=fontname/size. For example, I use FONT=Times/15 in my personal set up, to make the fortunes come up in 15-point Times. If a fortune is going to be too big for the screen because you've chosen a big font, the program will go and look for another one. I have yet to find a font with which this doesn't work. B. DEFAULT This tool type controls which file the program reads its data from if you click on the program's icon to start it. It has the form DEFAULT=filename, for example, DEFAULT=sys : jokes/blue. If you don't say what directory the default file is in, the program will look in the current one. FLAGS There are three flags, which you can combine in different ways. They are: IG - show only fortunes which are more than 7 lines long, IN - start off the program in 'icon' mode, `AK - say the first fortune displayed. These flags can be combined using the vertical bar "l". Examples of flags tool types are: FLAGS=SPEAK, FLAGS=LONGIICON. DELAY This can be used to change the delay between fortunes. It has the form DELAY=time, where 'time' is the number of seconds delay you want. Using the Program from the CLI You can run the program from the CLI just by typing "fortune", provided the data file "fortunes" is in the current directory. A fortune will be printed into the shell window. The program has quite a few options, which I'll now list: show a help page (useful, eh?) show a help page (the same one) f<file> show a help page (again) change filename show long fortunes only open a window These options are only useful if you open a window too (i.e. use option -w as well) -d<time> set delay to <time> seconds -i start in 'icon' mode -p<pos> open the window <pos> pixels down the screen -m <height> maximum size of window is <height> pixels. If you are using -w to open a window, it's a good idea to put "run" before the fortune command, to run it in the background, otherwise you won't be able to do anything else in the shell until you quit the program. A few examples : fortune -1 -fsys : fortunes/ jokes Print a long fortune from the file sys :games/fortunes run fortune -w -i -d5 -ffunnies Start the fortune program up in icon mode, with a window and a delay of 5 seconds, reading fortunes from a file called 'funnies" in the same directory. Then return control to the shell. Making your own fortune files To write your own files, use an ASCII editor like ed or emacs to produce a file of fortunes separated by lines with two percent signs on their own. For example, Life, don't talk to me about life ... %% Beware of programmers who carry screwdrivers Leonard Brandwein "Ask not for whom the bell tolls, if thou art in the bath, it tolls for thee" is a perfectly good (but rather short) fortune file. Then type into a CLI window (assuming the program 'makefort' is in your current directory of somewhere in your search path , like the C directory) : makefort <input file> <output file> For example, if your ASCII file is called "myfortunes. txt" and you want the actual compressed fortune data file to be called just "myfortunes", type makefort myfortunes .txt myfortunes You should then get some messages telling you what it's reading or writing or whatever. Possible error messages are: file not found The program couldn't find the input file. fortune too big The fortune being read in was over 2K long. Edit the file and remove it. unable to allocate You've run out of memory. Go to your nearest dealer and buy a nice big memory expansion (4 megs is nice :- ). This error can also happen if you have a fortune of zero length (i.e. two successive lines with "%%" on them). unable to open file Couldn't open the output file. Perhaps you're trying to write it into a directory that isn't there. unable to write icon The program couldn't write the data file's icon for some reason. Once you've created your file, you can read a fortune from it using the "-f" option from the CLI, or click on its icon from the workbench, provided the fortune program is in the same drawer. I hope you enjoy this program, and soon fill files with wonderful quotations and similar stuff. If anyone wants the HUGE version of the fortune file, with over 1900 quotations, and has 200K to spare on a disk, send a blank disk and an SAE to me at Jim Finnis, Pen-Y-Lan, 64 Great Darkgate St. Aberystwyth, Dyfed. SY23 1DE nd it back to you ASAP, with any new version of the