Randomcopy V0.5 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/A sourcepattern TO/A destinationfile QUIET/S CLONE/S ABOUT/S 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 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 only. This may be changed in future releases. The QUIET switch supressed any console output. This is useful for scripts, mainly the startup-sequence. The CLONE 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. The file includes a $VER string, which can use the command version to read. 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 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 CLONE feature. I don't know why I put it in, really. o Adding a random or set time feature. You could give the program a range and it would copy the file. You could have a different picture every 15 minutes or so. This would work in a script for a slideshow effect, also. I had orginally planned this, but... o Making the command even closer to the COPY command. It should include at the least the NOREQ switch. But I'm not sure how. Maybe check the device list with a doslist? Send me help! And of course, I know of at lease one bug that needs to be fixed: * If the command line includes spaces at the end, it conks out. This will be looked into. I hope this doesn't piss anyone off... Good luck, and I hope this spices up your ole workbench screen. Merry X-MAS!