home *** CD-ROM | disk | FTP | other *** search
- /* */
- /* GfxLab24 - Catalog-Maker */
- /* */
- /* Script by Rodrigo Reyes, 1995. */
- /* Should be used with GfxLab24 version 1.4 or + */
- /* */
-
- /* This ARexx script is devoted to the annoying task of making */
- /* catalogs for your pictures. */
-
- /* To run it, simply indicate to the script some filenames or */
- /* file patterns : */
- /* */
- /* rx CatalogMaker.rexx dh0:pictures/#?.GIF dh1:hello.iff */
- /* or if you are running any Unix Shell or WildStar program: */
- /* rx CatalogMaker.rexx dh0:pictures/p*.gif dh1:hello.iff... */
- /* */
- /* The script can accept any number of names or pattern. */
- /* */
- /* The default parameters for the catalog are : */
- /* (You can change any of them by just specifying it in the */
- /* command line with a parameter, if needed. ie: */
- /* rx CatalogMaker.rexx #?.GIF BASENAME mycat ROWS 6 COLUMNS 4 */
- /* options can be anywhere in the command line */
- /* */
- /* BASENAME : Name of the catalog that will be created. It will */
- /* be saved under the name BASENAME.#.jpeg, with "#" is the */
- /* index of the created catalog, 0 for the first, 1 for the */
- /* second, etc. Default is "Catalog" */
- /* */
- /* NOTEXT : This is a flag, and require no paramater. If you */
- /* put this keyword on the command line, no text will be */
- /* added under the pictures. This is not set by default. */
- /* */
- /* ROWS : This option specify the number of rows of pictures the */
- /* catalog will have. By default, it is set to 4, so that */
- /* 4 pictures will be put in a single line. */
- /* */
- /* COLUMNS : The number of columns the catalog picture will have.*/
- /* The default is 4, so that 4 lines of pictures will be put */
- /* in the catalog file */
- /* */
- /* IMAGEWIDTH : This option let you specify the width in pixel */
- /* for a picture sample. The default is 120. */
- /* */
- /* IMAGEHEIGHT : As above, but this option is for the height in */
- /* pixel of the picture sample. The default is 120. */
- /* */
- /* HIGHQUALITY : This flag, if found in the command line, will */
- /* improve the quality of the rendered pictures, by */
- /* converting the bitmap picture to 24 bits, & scaling them */
- /* with highquality scale, before adding them in the catalog.*/
- /* Of course, the original pictures won't be affected. */
- /* */
-
-
-
- /* Address the GfxLab24 Arexx port */
-
- ADDRESS GFXLAB24.0
- options results
-
- /* Put here your inits */
-
- BaseName = "Catalog"
- FontSize = 8
- MyFont = "topaz.font"
-
- imagewidth = 120
- imageheight = 120
-
- maxrow = 4
- maxcol = 4
-
- row = 0
- col = 0
-
- ImageIndex = 0
- arguments = ARG(1)
-
- HighQuality = 0
-
- PutSomeText = 1
-
- dummy = Find(arguments,"NOTEXT")
- if (dummy>0) Then
- Do
- dummy = DelWord(arguments, dummy,1)
- PutSomeText = 0
- End
-
- dummy = Find(arguments,"ROWS")
- if (dummy>0) Then
- Do
- maxrow = word(arguments, dummy+1)
- dummy = DelWord(arguments, dummy,2)
- End
-
- dummy = Find(arguments,"COLUMNS")
- if (dummy>0) Then
- Do
- maxcol = word(arguments, dummy+1)
- dummy = DelWord(arguments, dummy,2)
- End
-
- dummy = Find(arguments,"IMAGEWIDTH")
- if (dummy>0) Then
- Do
- imagewidth = word(arguments, dummy+1)
- dummy = DelWord(arguments, dummy,2)
- End
- dummy = Find(arguments,"IMAGEHEIGHT")
- if (dummy>0) Then
- Do
- imageheight = word(arguments, dummy+1)
- dummy = DelWord(arguments, dummy,2)
- End
- dummy = Find(arguments,"HIGHQUALITY")
- if (dummy>0) Then
- Do
- highquality = 1
- dummy = DelWord(arguments, dummy,1)
- End
-
- dummy = Find(arguments,"BASENAME")
- if (dummy>0) Then
- Do
- BaseName = word(arguments, dummy+1)
- dummy = DelWord(arguments, dummy,2)
- End
-
-
- RealWidth = imagewidth + 5
- RealHeight = imageheight + 5
-
- if (PutSomeText >0) Then
- Do
- RealWidth = imagewidth + 5
- RealHeight = imageheight + FontSize + 6
- End
-
- /* Print a message in GfxLab24 info window */
-
- PrintInfo ''
- PrintInfo '"Beginning of the Catalog-Maker AREXX script"'
- PrintInfo '"Script by Rodrigo Reyes, 1995"'
- PrintInfo '"Creating catalog of 'maxrow'x'maxcol' pictures"'
-
- 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(arguments,GfxListIndex)=''
-
- /* Get name from the command line */
- GfxMyList = WORD(arguments, 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 bank 4 /* Load the picture */
- if result = "OK" then
- DO
- if ((col<1) & (row<1)) Then
- Do
- PrintInfo '"Creating a new picture, size : 'maxrow*(imagewidth+5) ',' maxcol*(imageheight+5) '"'
- CreatePicture maxrow*(realwidth) maxcol*(realheight) 0 0 0 BANK 5
- if (result != "OK") Then PrintInfo '"'result'"'
- End
-
- /* Add want you want here */
-
- PrintInfo '"Copying the brush..."'
-
- if (HighQuality>0) Then
- Do
- BitmapToRaw BANK 4
- Scale imagewidth imageheight BANK 4
- End
-
- CopyBrush 5 4 row*(realwidth) col*(realheight) imagewidth imageheight
- PrintInfo result
-
- if (result = "OK") Then
- DO
- if (PutSomeText>0) Then
- Do
- CreatePicture ImageWidth FontSize+2 0 0 0 BANK 3
- Affiche = FileName;
- affiche = Right(affiche, Length(affiche)-LastPos("/",affiche))
- TextColor 255 255 255
- TextSize FontSize
- TextFont MyFont
- AddText Affiche 1 0 BANK 3
- CopyBrush 5 3 row*(realwidth) (col*realheight)+ImageHeight
- End
- else PrintInfo '"No text !"'
- row = row +1
- if (row = maxrow) Then
- Do
- row = 0
- col = col+1
- End
- if (col = maxcol) Then
- Do
- row = 0
- col = 0
- PrintInfo '"Saving 'BaseName'.'ImageIndex'.jpeg"'
- Save BaseName'.'ImageIndex'.jpeg' JPEG BANK 5
- ImageIndex = ImageIndex + 1
- End
- /* Free empty space for you script ... :) */
- END
- else PrintInfo '"Error, skipping file..."'
- END
- else PrintInfo '"Skipping unrecognized file 'FileName'"'
- END
- END
-
- if ((row>0) | (col>0)) Then Save BaseName'.'ImageIndex'.jpeg' JPEG BANK 5
- ClearBank Bank 5
- ClearBank Bank 4
- PrintInfo '"End of the Catalog-Maker Script"'
-
-
-