p2b.pl


p2b - A PERL Script to Generate Batch Files From .par Files

Copyright J.Watson 1998-99.

You can download the zipfile containing the p2b perlscript and documentation from spanky here.

p2b reads fractint parameter (.par) files and generates corresponding batch files that may be used to generate the images without further user intervention. To run p2b, type 'p2b' followed by the name of the .par file. The resulting output file is named after the .par file and may be run by simply typing its name.

e.g. to generate and run a batch file from the par file Mandels.par;

bash$ p2b Mandels.par Batch file Mandels.bat created bash$ ./Mandels.bat

Generated images are saved in a location specified by the 'gifdir' option, or in the current directory if 'gifdir' is not specified. Unless the 'o' (overwrite) option is used, if a gif file of the same name as the par already exists, the par will be skipped.

By default, the image file name is the same as the par entry i.e. a par file entry entitled 'Mandel_Zoom' will be saved as 'Mandel_Zoom.gif'. Alternatively, a savename can be specified (see Options) which will produce a numbered series of files all starting with the same text string.

So far, p2b has only been tested in a Linux system, using xfractint. However, it should run on any system that supports Perl although not all options are available to DOS users, see the section Notes for DOS Users . Please send any bug reports/suggestions to me at jimbo@eureka.lk and I'll do my best to correct/implement them. This is my first attempt at writing anything in Perl so there are bound to be areas that can be improved upon - if you see any, please let me know.


Usage

At the command line, type: p2b [-osvdph] file.par [gifdir=] [savename=]

Examples

p2b list.par
Generates a file called list.bat from the par file list.par.

p2b -v list.par gifdir=/home/jimbo/gifs/
Generates a file called list.bat from the par file list.par, verbosely reporting progress as it does so. When the batch file is run, it will search the directory /home/jimbo/gifs/ to see if a gif file of the same name as the par already exists. If it finds a matching filename, this par is skipped.

p2b -vp list.par newlist.par
Generates two batch files, called list.bat and newlist.bat. The user is prompted before entries are added to the files.

.


Options

Options may be specified either in the sstools.ini file or from the command line. Command line options override those specified in sstools.ini.The following options are currently recognised in this version.

o - Overwrite.
Produces a batch file that doesn't bother checking to see if the .gif file of the same name already exists, and over writes it if it does.

s - Safe.
Produce a file that checks to see if a file of the same name exists. If it does, that par is skipped. This is the default behavior of the system, this option is included to override options set in sstools.ini.

v - Verbose.
Verbosely reports progress to the screen.

q - Quiet.
Does not report progress to screen. This is the default behavior of the system, this option is included to override options set in sstools.ini.

d - DOS.
DOS mode, produces a DOS style batch file (largely untested). See the section Notes for DOS Users .

p - Prompt.
Prompt before adding a par to the batch file. Will ask for confirmation before adding a par from the batch file (yes or no) before adding an entry to the batch file. A third response 'a' will add the par displayed and all of the others to the batch file without further prompting. Useful for skipping those t=take:for:ever pars. The fourth option 'x' exits p2b saving the batch file with pars already entered.

h - Help.
Display a help message and quit.

file.par
The fractint par file(s). Wild-cards are accepted.

gifdir=
The location of the directory to search for existing .gifs

savename=
The root of the filename which the .gifs will be saved to. This will be terminated with a number and the extension .gif e.g. savename=mndl will generate the files mndl1.gif, mndl2.gif etc. If a savename is specified, 'overwrite' is automatically turned off.

.


Running the Output Script (for (LI/U)NIX users)

A typical script (for Linux, i.e. no -d option) would look similar to the following, produced with the command 'p2b.pl fml_9708.par';

#!/bin/sh # Script generated by p2b version 0.1 # pars taken from the file fml_9708.par # Fri Jan 8 07:38:33 1999 echo "Generating Partwave. Image number 1 in file fml_9708.par " if [ ! -f "/usr/local/packages/xfractint/gifs/Partwave.gif" ] then if xfractint "@fml_9708.par/Partwave" batch=yes savename=p2btmp then mv p2btmp.gif "/usr/local/packages/xfractint/gifs/Partwave.gif" echo Saved to: "/usr/local/packages/xfractint/gifs/Partwave.gif" else rm p2btmp.gif fi else echo "The file /usr/local/packages/xfractint/gifs/Partwave.gif already exists, not overwriting." fi

To run the script, type ./fml_9708.par. This in turn will call up xfractint and start generating the pars contained within fml_9708.par. A par may be skipped by pressing the space bar during its generation. Any partially generated images will be discarded.

From the above, it can be seen that in order to get around the 8.3 file naming limitation, the .gif file is initially saved to a temporary file 'p2btmp.gif' before being renamed using a longer filename. (the file p2btmp.gif is deleted in the event of an error during the generation of the image).


Use of the sstools.ini File

It's possible to store frequently used options in the sstools.ini in a section called [p2b]. Valid options are given in the example below

[p2b] overwrite=no ; or, overwrite=yes verbose=yes ; or, verbose=no prompting=yes ; or, prompting=yes mode=dos ; Unix user's delete this line. ; the line below is the location of my 'gif' directory gifdir=/usr/local/packages/xfractint/gifs/ savename=mndl video=sg2 ; this is only used in DOS mode

The above example shows all of the recognised options in the sstools.ini file. Only the required options need be specified, or, none at all.


Requirements

To run this script, you need to have Perl installed on your computer. Details of how to obtain this may be found at http://language.perl.com/

p2b was written and tested using Perl 5.002 on a Linux system, along with xfractint 3.04 (fractint 19.6). Please write and let me know if it works on different platforms.


Notes for DOS Users

The program will generate batch files for use on DOS systems but without some of the options open to Unix users. Operations affected are;

Prompting.
Due to the way in which keystrokes are detected by p2b, using a system call, this option is not available when generating DOS batch files.

Overwriting & Save File Names.
Because of the limitation of the 8.3 file naming in DOS, the par names are truncated to 8 characters long and used as the savename.

Their may be some other changes required to the script in order to get it to run on a DOS system. If any changes are required, please write and let me know so I can incorporate them here.

DOS users ought to try Michael Peters original PartoBat.software which is available from http://spanky.triumf.ca/www/fractint/fractint.html


Acknowledgments

Sincere thanks to Michael Peters for sending me a copy of the partobat source code. A copy of this program may be downloaded from http://spanky.triumf.ca/www/fractint/fractint.html

Thanks also to Bruce Haxton for help writing to files with names containing unusual characters.

Many thanks also to all the contributers to the fractint discussion list for providing and endless stream of excellent .par files to test this code on.


Fractint discussion List

If you find this software useful and you're not already a subscriber to the fractint discussion list, you're missing a lot. To subscribe, send a message containing ``subscribe fractint'' in the body (empty subject) to majordomo@lists.mission.com

As a service to fractint users, Les St Clair archives each months pars and makes them available at http://ourworld.compuserve.com/homepages/Les_StClair/fml.htm


Happy Frac'ing.......