Randomcopy V0.90 1. Disclaimer. READ FIRST! The author of this program, randomcopy, cannot be held responsible for any damage caused, either direct or indirect, to any files, programs, or hardware resulting from proper,improper, or normal usage. Use at your own risk. Randomcopy, including all executables and source, is ® Copyright 1993 by Chad Randall and mbissaymssik software. This program is not shareware, but is FREEWARE. You needn't pay a dime to use, it's free. This means it's free to everyone, and you may not charge any money for it (sell it). This right is reserved by the author. You may, of course, charge for duplication fees, storage media, or shipping charges. Commercial distribution is prohibited. If you feel you company would like to include this file with your product, you may contact the author. 2. Copyright notice. Once again, this program, including all binaries, text, and source is; ® Copyright 1993 by Chad Randall and mbissaymssik software. All rights reserved. 3. Introduction Workbench 2.x or higher is required. If you do not have 2.x yet, I strongly suggest you run out and get it. Or better, get an A1200. It's quite nice. Randomcopy is a small CLI interface run command. It accepts a wildcard pattern for a source and a filename for a destination. Example: randomcopy FROM PREFS:presets/patterns/#? TO env:sys/wbpattern.prefs Randomcopy will scan the directory at PREFS:presets/patterns for any files. It will choose one at random and copy it into the file env:sys/wbpattern.prefs. 4. Why use it? I had a bunch of workbench backdrop pictures on my 1200 and wanted to be able to have one choosen at random at bootup. I thought of many ways of doing it. I believed others might want random pointers, palettes, etc. Then I thought that there might be other usages for it too (send me ideas!). Of course, the main reason I can see to use it is to have a random pref file each time you reboot. This is the main reason to use it as of now. An AREXX script could probably be written to do basically the same function as this program. But isn't it easier just to download this small file from Aminet? And how many people *really* know AREXX? I don't.. 5. Usage To run the program, it must be done from the CLI. No wbinterface is included. It has to be given a minimum of two parameters, similar to the CLI COPY command. randomcopy FROM,TO,MINWAIT,MAXWAIT,USETICKS,LONGBREAK,QUIET,CLONE,NOREQ, BUFFER,ABOUT The FROM keyword is optional. If it isn't present, the first argument encountered will be the source. Same with the TO keyword. The sourcepattern (FROM) argument is just that, a pattern. Of course, this might be a filename. A filename is a pattern, but of course, there will be no randomness about it. It will happily copy the file. The destination argument must include a filename. You can't copy to a directory name or a pattern. Only a file. This may be changed in future releases. The MINWAIT is the minimum amout of time to wait. If the USETICKS is not present, than this is in seconds. The MAXWAIT is the maximum amout of time to wait. If the USETICKS is not present, than this is in seconds. If only one WAIT statement is present, than basically the program will wait a specified time. Otherwise, a random time is picked between the MIN and MAX. The USETICKS switch specifies that the MINWAIT and MAXWAIT amounts are specified in clock ticks. This is stated as be 50 ticks per second in the RKM's. This may be 60 per NTSC (vblank), so adjust accordingly. I've tested the waits and they seem fairly accurate. The LONGBREAK switch specifies that you wish the program to use sleep the entire time it is waiting. If this switch is not specified, than the randomcopy checks for a break (ctrl-c) signal every 100 ticks. If this switch is ON then you may not break to program until a wait is finished. If you wait is 15 minutes, then you must wait the entire time. Use with care. The QUIET switch supresses any console output. This is useful for scripts, mainly the startup-sequence. This should suppress ALL text, unlike earlier versions which seemed to carry some debug stuff. Opps. The NOREQ switch is not implemented as of yet, and is basically ignored. The ABOUT switch will print (if QUIET is not present) some information about the program, and will give some addresses. Note that randomcopy still needs a source and destination. The file includes a $VER string, which can use the command version to read. All 2.x programs and libraries should carry this. Listen up! 6. Examples Having a directory full of small text files, each containing a small fortune cookie message. Just use: randomcopy cookies:#?.txt ram:yourfortune type ram:yourfortune This will copy a file from a list of matching filenames to the RAM drive. Then the message is printed to the console window. But for a more impressive result: randomcopy pictures:(#?man#?|#?dog#?) ram:showme.pic viewpic ram:showme.pic delete ram:showme.pic This will select a pic with either "man" or "dog" in it's name from the directory pictures. Then of course, the selected picuture is displayed. And finally the picture is deleted. When you run workbench, usually (hopefully), a small daemon called IPrefs is run also. This program checks for alterations to any preference file stored in ENV:. You could then run this program at any time to randomly copy a file from a set of presets into it's matching env:sys/ counterpart and have the modifications take place automatically. Include a oneliner in the shell-startup script, and every time a new shell starts you could have your window patterns or your pointer change. 7. Tips Of course, you would not want to copy an .info file. Just use the power of OS 2.x pattern matching: randomcopy PREFS:presets/patterns/#?~(#?.info) ENV:sys/wbpattern.prefs This will exclude any info files, so you could still use workbench to move, modify, or update your preset settings. Use your imagination! 8. Contacts for info or bug reports. This is my first semi-finished project. Of course it is one of the smaller ones, too. But I'm sure there are many bugs still in the code. You can send me EMail at crandall@garnet.msen.com I would really appreciate any comments; good, bad or the ugly. Even flames. If you live in timbuktu and don't have Internet access (poor, poor thing.) you can send USNAIL to me at 229 S.Washington St, Manchester, MI 48158-9680. This is in the US of course. 9. Plans, notes, and bugs. There are many things I can do to this program given some more time. This includes: o Activating the NOREQ feature. Any suggestions how would be nice. Do I change my process window pointer to -1, or do I search the device list? How do I go about either??? Help. o Are there any bugs to be fixed? 10. Other stuff. I'm currently working on a replacement for IconEdit 3.0. It'll let you really save icons with more than 8 colors. It's got a lot of stuff to be done. Most important of all, I need to play with the iffparse.library and learn what's going on. I was also thinking of learning datatypes so you could convert .ICO files from Windows. This might be a later addition. Let me know if you are interested in taking a look. Hopefully it will be usable in a week or two. I just love 'E'! Good luck, and I hope this spices up your ole workbench screen. Happy New Year!