*************************************** DoSomething 1.0 - A file action program by Maarten C. ter Mors (mcmors@cornnet.nl) *************************************** 'Don't just stand there -- DO SOMETHING !' - hysterical wife to her helpless husband Legal mumbo jumbo ----------------- This program is distributed as Freeware, which means to say you may and are encouraged to copy it freely and give it to other people. This includes uploading the software to BBS systems, FTP sites et cetera. You may also include it on magazine cover disks / CDs and on Amiga PD CDs, such as the Aminet series. You must, however, keep the original program, source and documentation intact if you distribute the program. You are NOT allowed to make any profit from the distribution of this program and you may ONLY use it as part of a commercial distribution with written permission from the author. You may use the source and the program itself in your own (non-commercial) software, just so long as you mention the name of its original author, Maarten ter Mors. The program, source and documentation remain © Copyright 1996 by M.C. ter Mors. What is it ? ------------ DoSomething is a small program for the Commodore Amiga range of computers, which will presumably also run on Amiga compatible clones and emulators. The only system requirements are Kickstart 2.04 (V37) or higher and a file system that supports file notification (e.g. FFS, AFS etc.). With this program you can let the Amiga perform actions automatically as and when files and/or the contents of a directory change. To do this, it uses a standard feature of the OS called file notification. For more information on this, please refer to the DOS autodoc. Why do I need it ? ------------------ There has been a number of situations in which I found myself performing actions on files after they had downloaded, rendered or grabbed from my digitizer. Simple examples are unpacking archives into my test directory, moving rendered or grabbed frames to a different location under a different name, and so on. In many cases, it would be very easy if you could have these actions performed automatically. Another possible use would be to keep an eye on certain files to see if they change, e.g. your startup files or your LIBS: directory. How do I use it ? ----------------- It's easy, really. The template for DoSomething is: DoSomething FILES/M,ACTION/K,CONFIG/K where FILES/M The files or directories to perform the action on. This may be any number of files. If you use many files, however, you might be better off putting them in a configuration file instead of typing them on the command line (see below for configuration options). ACTION/K The action to perform, as an AmigaDOS command. This can be a "dir", for example, but you can also start scripts or programs. Just make sure the string behind ACTION is the same what you would type in the shell. As an extra option, you can specify _ONE_ occurence of the sub-string %s in your ACTION string. DoSomething will substitute the name of the object the notify took place on here. Note that if the original notify was on a directory, the filesystem will only return the name of that directory. NOTE 1: The settings for the executed command are: Stack 4096, Input & Output >NIL: If you require a different (i.e. larger) stack size, you should make a script file like ; Script to set stack and run program Stack 100000 ; Example value MyProgram The Input and Output may of course still be redirected with the > and < operators as usual. NOTE 2: You cannot use additional quotes in the action string. This is because ReadArgs() parses the input and it can't handle strings-within-strings, to my knowledge. Once again, you'd have to make a script. NOTE 3: You must specify the ACTION keyword. Examples: --------- 1> DoSomething FILES RAM: ACTION "Dir >CON: %s" Shows the directory of RAM: when a new file is written to it. 1> DoSomething FILES LIBS:mathieee.library LIBS:mathffp.library ACTION "Execute S:StartDOpus" Starts a script in S: that (presumably) in turn starts Directory Opus, as soon as somebody messes with your math libraries. (Hey, nobody said these examples had to make sense :-). CONFIG/K Specifies the name of a configuration file. Once again, you have to specify the keyword CONFIG explicitly. If you use this option, you may omit the FILES and ACTION options. The format of the configuration file is simple. Each line is a combination of a FILES list of names and an ACTION, just as you'd type on the command line. So, an example configuration would be: FILES RAM: ACTION "PlaySound Work:Music/Samples/OYeah" FILES S:User-Startup ACTION "GetEnv >CON:0/0////WAIT PPPIPLocal" FILES L:File1 T:File6 SYS:System ACTION NewShell and so on. Theoretically, there is no limit to the amount of lines. You are advised not to insert any non-command lines in the configuration file, like comments etc. Incomplete lines, i.e. without both a valid file list and an ACTION keyword shouldn't actually do anything, but this has not been thoroughly tested. So be prepared for unpredictable results if you specify bogus lines in your config file. Something else you might like to know, is that DoSomething automatically detaches from the Shell it was started from. This makes it perfect to be started from S:User-Startup. Why is this manual crap ? ------------------------- Because I don't like to write manuals, especially not for these small tools. Besides, there's not too much to tell about this program. If you have any questions, contact me (below). Who wrote this marvel ? ----------------------- Maarten Cornelis ter Mors Schubertlaan 52 2625 VE Delft The Netherlands email: mcmors@cornnet Feel free to contact me by either snailmail or email if you have anything to ask, add or complain. Signing off, /|/| ___ /|/| / | |aarten |er / | |ors