Documentation PickFile Version 1.2 FreeWare @ 1992/93 by H.P.G Index: ====== Index What is PickFile ? System Requirements Legal stuff PickFile Start Options Examples Technical At Last Addresse List Of Files What is PickFile ?: =================== Under OS 2.xx it is now possible to use different sets of fonts, patters and mouse pointers and to change them in a very easy manner. Since I use this new system, I feel very happy if I use well designed wbench pattern or window pattern or different overscan sizes or different sets of fonts for my wbenchscreen. But if I have used e.g. a window pattern for a longer time, I usually want to change this pattern. So first I have to start the WBPattern program which is located in the `sys:prefs/` drawer ... After designing a new pattern, I have to save it as default. After some time of using this pattern the whole procedure starts again and again and not only for patterns than also for fonts colours etc.. PickFile can help you. PickFile chose randomly an entry out of a list or optionally a file out of a drawer. Then PickFile executes this file or an optional commandline which must be supplied. PickFile has a variety of applications and is useful for starting all kinds of files and programs. PickFile (PF) is not only able to chose a file, but also to execute a whole commandline which has to be supplied. You can also ask PF to chose more than one entry by one call. To write about all possible kinds of aplications you may use PF for, I haven`t the time and imagination here. You can use PF for calling prefs files or to start sampled sounds (randomly) or just to create a slideshow with a randomly order of your pictures... I have also include an example in the examples drawer. I have also included some examples in this document. (See Tutorial). System Requirements: ==================== PickFile needs kickstart 2.04 version 37L or better to run. Under version 36L (1.4) or 1.3 it is not able to run, because of the usage of some OS 2.xx only features for pattern matching and commandline editing. (Sorry). Legal Stuff: ============ This program  and all files come with it, also the docfiles, are released as FREEWARE. this means: everybody may use PickFile, everybody may copy PickFile, if: 1. You copy all included files, see list at the end of the doc file. 2. No changes are made, this  means  the  program and all included files must stay in the original form. Exception: you may archieve it; but in this case you must also archieve the whole package. 3. If you recompile it, you have to include a notice to the original author. If you also want to (re)distribute in any new form you have to send me a copy. 4. You may not sell PickFile. Execption: you`re allowed to take a small copy fee which should not extend 5US$. 5. If you want to include PickFile or one of the included files as a part of a commercial package, you must have written permission of the author (address see below). I take no warranty or guaranty for the function of this program. The whole risk of using PickFile stays only by the user. PickFile Startoptions: ====================== If you start PF from WBench, you will get only a short helptext. If you instead call PF from CLI, so it uses the following Syntax: [File=F/K][Dir=D/K][MinVal=M/N][MaxVal=X/N][Test=T/K] [Quiet=Q/K][Help=H/S][Cmd=C/F] File=F/K : If you specify file, than this file is read by PF. One line of this file will be randomly chosen. The given commandline will be used, if supplied one (see later Cmd). The File will be loaded in memory and then processed. This saves a lot of time. The syntax of this file will be described below. See also the examples section. Dir=D/K, : If you instead specify Dir no file will be processed but this dir is examined and a file of this dir will be randomly chosen. If given, a commandline will be used. (see later under Cmd). If you omit this commandline the chosen file will be started as an cli program. Pat=P/K : After Pat you can specify a pattern after AmigaDOS conventions. So only matched files will be processed and the selection can only be one of the matched files. The pat option will only be used if you use the dir option, otherwise this option will be ignored. MaxVal=X/N : Here you can specify the number of entries which should be chosen by PickFile. The maximum value depents on the number of lines by use the file options or the number of files when using the dir option. If you specify a larger number the maximum available value will be used. Default: 1 Test=T/S : If you use Test, the given commandline or the chosen file will not be executed but displayed in the cli window. This means you can use this option to see which commandline would be executed when run PickFile without the Test option. (Great for testing and debugging settings). Quiet=Q/S : If you use instead the Quiet option, PF doesn`t tell you which selection is done and which command is executed. Usually PF informs the user about the commandline which is currently executed. If you want to call PF e.g. in your startup-sequence to select a set of patterns, then the output of PF would opened the shell window. If this option is used the window still stays closed. (see also AmigaDOS manual Shell-Flag (AUTO)). This option is also useful for batch files which should not print any output to a shell window. Default: OFF. Help=H/S : If you use Help or the commandline contains any error a short helptext will be printed out. Cmd=C/F : This is the most powerful option. After the Cmd keyword you can specify a whole command line with all kinds of arguments. This commandline will then be called after chosing an entry. This option is available under file and dir option. The commandline may be embedded in "",s but this is optional. But if you use another shell than the standard shell e.g. CShell, I will recomment, to do this to prevent pattern expandings before calling the commandline. All included []`s will be automatically replaced with the chosen entry. If you specify multiples selections this commandline will be called again for each entry. (see also MaxValue). So you can use PickFile also for recursion calls (BE VERY CAREFULL) For all options: you may use all options in any order. Exception: Cmd must be the last argument. All options are optional (what a surprise :-). But also here exists one exeption: You must either specify a file or a dir. If you specify a file and a dir the file will be processed and the dir ignored. The syntax for the file must follow this conventions: The file must be 100% ascii code. There must not exists any kind of comments, because, to handle this, would slow down the program too much. Each line represents a command line. If you also supply a command line (Cmd option), PF thinks it should pickup one or more lines of the file and replace the given []`s of the command line. So you see there should be no leading spaces in the lines. Examples: ========= Now there are some example callings and commandline options and their use. 1. Example: lottery program --------------------------- This example is included in the examples drawer. Assuming you have a file calling `Lotto.dat` in the current directory which includes all numbers from 1 to 49 one number in each line. Assuming we want to chose 6 numbers randomly from 49 and we want to print out the selections you can use the following example commandline PickFile F Lotto.dat X 6 C "echo [] > PRT:" | | | | | ---> This command line will be executed for | | each chosen number. | | | ------> This tells PF to chose 6 different | numbers out of the file | ------------------> This is the file which cointains the used numbers 2. Example: Randomly using of wbpattern set ------------------------------------------- Assuming we have several wbprefs patterns located in the sys:prefs/presets drawer (these can be designed with the WBPattern program and be saved with the menuitem Save As). Assuming these wbpattern sets are called `wb.1.pat`, `wb.2.pat` ... `wb.n.pat`. If you now insert the following line into you startup-sequence: ..... PickFile D Sys:Prefs/Presets/ P "wb.#?.pat" Q C "Copy [] env:sys/wbpat" ..... Endcli >NIL: ,so PickFile randomly picks up a set of these patterns each time you boot up. To process only the wb.##.pat files, we have to specify here Pat with the pattern 'wb.#?.pat' (for pattern matching see also AmigaDOS manual). With Q (for Quiet) no outputs will be sent to the shell window, so the AUTO boot shell window will not be opened. The commandline `Copy [] env:sys/wb.pat` will be replaced with e.g. (Assuming PF had chosen wp.1.pat). ====> Copy wb.1.pat env:sys/wb.pat After calling the IPrefs program in your startup-sequence this pattern file is used for the wbpattern (really good ?). You can use this example also to change other environments like i.e. screen sizes (NTSC-PAL or InterLaced/NON-Interlaced mode etc...) (this functions also later at any time). You must therefor only change the Pat and Cmd line patterns. 3. Example: Slideshow with several pictures in a randomly order --------------------------------------------------------------- Assuming we have a disk with the name `PICTURES:` and this disk contains 20 different picturs. So we simply can use the following example call to PickFile to create a full slideshow and starts it. I assume also that you have a picture viewer in the C: directory which is called Show. PickFile D Pictures: X 20 Q C "C:Show []" All 20 pictures will now be displayed in a randomly generated order. No outputs will be sent to the cli window. For each picture the commandline `C:Show []` with the chosen picture name instead of the []`s will be executed. I assume that C:Show can display the given picture when specified at start time. There is an endless list of other applications which can be used with PickFile. If you know any other interesting application please let me know. Technical: ========== I spoke in this manual often about randomly selections. The random generator routine is created by using the system time (micros) to initialize the ran() routine. The selection is then performed by calling sran(). If you use multiple selections, I take care that each entry is chosen only once. Also if you specify more entries in a list or files that exists, only the correct number of entries will be used. To prevent errors in command line execution, the selection of drawers is not supported, they will be only ignored (certainly except in path specifications). At Last: ======== I hope (really) that there are some people out there which are interested in this wonderful tool and stays here as your H.P.G Addresse: ========= Hans-Peter Guenther Gruener Weg 5 3501 Fuldatal 2 W-Germany List Of Files: ============== (If you miss one or more of the following files your release is incomplete) PickFile : The binary PickFile.info PickFile.doc : English manual PickFile.doc.info PickFile.dok : German manual PickFile.dok.info Examples (dir) Examples Lotto.dat : Lottery file (Example 1) Lotto.dat.info ----END