/*   OilPainting.rexx                                             */
/*                         Rodrigo Reyes 1995                     */
/*                                                                */

/*                                                                */
/* This script takes some files on its command line, and process  */
/* some effect on them, which should give something like oil -    */
/* painting.                                                      */
/*                                                                */
/* The script save the oiled picture as FILENAME.oil.jpeg.        */


/* To use this script, type inside a command shell :              */
/*                                                                */
/*     rx emptyscript.rexx FILENAME                               */
/*                                                                */
/*  example :                                                     */
/*                                                                */
/*     rx ArexxScripts/oilpainting.rexx #?.gif b.jpeg c.ilbm      */
/*     rx ArexxScripts/oilpainting.rexx dh0:pic/#?                */
/*                                                                */
/* Dont forget that if the full path is not added, the pictures   */
/* will be searched in the current directory of GFXLAB24, not     */
/* the one of the shell that launched the script.                 */

/* Of course, under Csh and other Unix shells, you should not     */
/* use #? but "*" instead. The reason is that unix shells don't   */
/* send the pattern, but replace it directly by the corresponding */
/* file names and #? is not understood by Csh.                    */


         /* Address the GfxLab24 Arexx port */

ADDRESS GFXLAB24.0
options results

         /* Put here your inits             */


         /* Print a message in GfxLab24 info window */

PrintInfo ''
PrintInfo '"Beginning of the OilPainting AREXX script"'
PrintInfo '"Script by Rodrigo Reyes, 1995"'

GfxListIndex = 1    /* Scan all the names in the command line */
                    /* that was given to the script, starting */
                    /* with the value in 'GfxListIndex', until there */
                    /* is no more names in command line       */
                    /* (while the current name is not empty)  */
DO UNTIL word(arg(1),GfxListIndex)=''

                    /* Get name from the command line */
    GfxMyList = WORD(arg(1), GfxListIndex)
    GfxListIndex = GfxListIndex + 1

                /* GetFromPattern is a GfxLab24 function that  */
                /* return a list of filenames corresponding to */
                /* the given argument. This argument should be */
                /* a pattern, but a single filename is ok and  */
                /* bug-proof.                                  */

    GetFromPattern GfxMyList
    GfxMyList = result
    if (WORD(GfxMyList,1)="ERROR") Then Exit
    GfxsubListIndex = 1
    DO UNTIL word(GfxMyList,GfxsubListIndex)=''
        FileName = word(GfxMyList,GfxsubListIndex)
        GfxsubListIndex = GfxsubListIndex +1

        PrintInfo '"Processing 'FileName '"'
        Load FileName               /* Load the picture */
        if result = "OK" then
             DO
                        /* Add want you want here */

                 DispersePixel 1
                 Quake 3
                 Quake 3 VERTICAL
                 Convolve "convolve/triangle"

                        /* Free empty space for you script ... :)  */

                  Save FileName".oil.jpeg" JPEG

             END
    END
END
PrintInfo '"End of the OilPainting Script"'


