home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / grafix / ultraconv / rexx / filterdemo < prev    next >
Encoding:
Text File  |  1997-08-06  |  5.1 KB  |  146 lines

  1. /* FilterDemo ©1997 by Felix Schwarz
  2.    This small script does previews of ALL filters,
  3.    that are available in UConv. You can use parts
  4.    of this Rexx-script in your own scripts..
  5.    This script would be MUCH shorter without comments,
  6.    so please go trough it.. it isn`t that long as it
  7.    seems to be..
  8.  */
  9.  
  10.     options results
  11.     address 'UConv'
  12.     /* Let`s get the number of filters and Anim-F/X currently available */
  13.     FILTNUM
  14.     fn=result
  15.     ANIMFXNUM
  16.     afxn=result
  17.     summ=fn+afxn
  18.  
  19.     /* .. and show them */
  20.     REQUESTER "Filter-Demo" "Wow!!" "You have "||fn||" Filters and "||afxn||" Anim-F/X available!|That are "||summ||" operators/effects in total!"
  21.  
  22.     /* Get a user-input */
  23.     REQUESTER "Filter-Demo" "Yeah!|No.." "Wanna do a complete overview over all your filters ?"
  24.     res=result
  25.  
  26.     IF res=1 THEN DO
  27.      /* Let`s ask the user for the location of the preview-files */
  28.      GETASLPATH "Set_the_location:" "T:"
  29.      dir=result
  30.  
  31.      /* Ok, we`ll use the UConv-Logo as the basis for our previews */
  32.      FIRSTINFILE "Ultraconvlogo.brsh"
  33.  
  34.      /* We wanna save it in JPEG */
  35.      OUTFORMAT 10
  36.      suffix=".jpg"
  37.  
  38.      /* Switch on the Filters and switch off the rest - but without poping up the GUI */
  39.      SCALEREQ OFF NOGUI
  40.      ROTATEREQ OFF NOGUI
  41.      DITHERREQ OFF NOGUI
  42.      ANIMFXREQ OFF NOGUI
  43.      ANIMPUBREQ OFF NOGUI
  44.      FILTERREQ ON NOGUI
  45.  
  46.      /* Open a progress bar with a statusline */
  47.      OPENPROGRESSBAR 1 "Doing filters.."
  48.  
  49.      /* Let`s set it */
  50.      SETPROGRESSBAR 1 0 "Writing AmigaGuide®-Header.."
  51.      OPEN('filtprev',dir||'Filterpreviews.guide','W')
  52.      WRITELN('filtprev','@database Filterpreviews.guide')
  53.      WRITELN('filtprev','@master Filterpreviews.guide')
  54.  
  55.      /* Which version of UConv are we talking with ? :-) */
  56.      UCVERSION
  57.      vers=result
  58.      WRITELN('filtprev','@$VER: '||vers)
  59.      WRITELN('filtprev','@author Filter-Demo-Rexx-Script 1.0')
  60.      WRITELN('filtprev','@(c) Felix Schwarz')
  61.      WRITELN('filtprev','@remark Created with FilterDemo V1.0 (C)1997 by Felix Schwarz')
  62.      WRITELN('filtprev',' ')
  63.      WRITELN('filtprev','@node "Main" "Filter-Demo-Rexx-Guide 1.0"')
  64.      WRITELN('filtprev','This cool guide was created by an even more cool ARexx-script')
  65.      WRITELN('filtprev','using the UConv-ARexx-port. Click on one of the filter-names,')
  66.      WRITELN('filtprev','to get a preview of the filters of '||vers)
  67.  
  68.      /* Let`s change the status */
  69.      SETPROGRESSBAR 1 0 "Writing HTML-Header.."
  70.      OPEN('html',dir||'Filterpreviews.html','W')
  71.      WRITELN('html','<HTML><HEAD><TITLE>Filterpreviews created by FilterDemo 1.0</TITLE></HEAD>')
  72.      WRITELN('html','<BODY BGCOLOR=#CFCFF0>')
  73.      WRITELN('html','<CENTER><TABLE BORDER=1>')
  74.      WRITELN('html','<TR><TD COLSPAN=2 ALIGN=CENTER><FONT SIZE=+2>Overview of all filters of UConv</FONT></TD></TR>')
  75.  
  76.      /* Now we`ll begin with the previews */
  77.      DO i=0 to fn-1
  78.       /* At first let`s begin with setting a filter */
  79.       FILTCSTAT 0 i 20
  80.  
  81.       /* What`s the filters name ? */
  82.       FILTNAME i
  83.       fname=result
  84.  
  85.       /* Set the progress-bar */
  86.       SETPROGRESSBAR 1 (i/fn)*100 'Doing: '||fname||'..'
  87.  
  88.       /* Let`s set the output-file and let`s convert */
  89.       file=dir||fname||suffix
  90.       FIRSTOUTFILE file
  91.       CONVERT
  92.  
  93.       /* How long did we need for this operation ? */
  94.       NEEDEDTIME
  95.       ntime=result
  96.  
  97.       /* Let`s create a cool column for the AmigaGuide®-Document and write the line */
  98.       MAKECOLUMN 30 fname
  99.       WRITELN('filtprev','@{"'||result||'" link "'||dir||fname||suffix||'/main"} '||ntime)
  100.  
  101.       /* What was the last size before saving ? */
  102.       GETLASTWIDTH
  103.       width=result
  104.       GETLASTHEIGHT
  105.       height=result
  106.  
  107.       /* Width>400 ? Doesn`t fit in a normal browser-window and looks stupid -> "scale" */
  108.       IF width>400 THEN DO
  109.        widthscale=width/400
  110.        width=400
  111.        height=height/widthscale
  112.       END
  113.  
  114.       /* Let`s save another line to the HTML-document */
  115.       WRITELN('html','<TR><TD>'||fname||'('||ntime||')</TD><TD><IMG SRC="'||fname||suffix||'" WIDTH='||width||' HEIGHT='||height||'></TR>')
  116.      END
  117.  
  118.      /* Let`s deselect the filter */
  119.      FILTSTAT 0 -1 1
  120.  
  121.      /* Let`s switch off filters */
  122.      FILTERREQ OFF NOGUI
  123.  
  124.      /* Close down the Hypertext-documents */
  125.      WRITELN('filtprev','@endnode');
  126.      WRITELN('html','<TR><TD COLSPAN=2>This HTML-overview was done by Filterdemo using '||vers||'</TD></TR></TABLE></CENTER></BODY></HTML>')
  127.      CLOSE('filtprev')
  128.      CLOSE('html')
  129.  
  130.      /* Close the progress-bar */
  131.      CLOSEPROGRESSBAR 1
  132.  
  133.      /* Let`s copy some icons and show the AmigaGuide */
  134.      Address command 'copy UConv:Doc_E.guide.info '||dir||'Filterpreviews.guide.info'
  135.      Address command 'copy UConv:Doc_E.guide.info '||dir||'Filterpreviews.html.info'
  136.      Address command 'sys:Utilities/Multiview '||dir||'Filterpreviews.guide'
  137.  
  138.      /* Nerv the user again ;-) .. and add a linefeed after look */
  139.      REQUESTER "Ready!" "Coool!" "The Rexx-Script finished its work.. also watch|the created HTML-document with your browser."
  140.  
  141.     END
  142.     ELSE REQUESTER "Filter-Demo" "Ok!" "Well, perhaps you`ll do an overview next time :-)"
  143.  
  144.     /* End of the script */
  145.     EXIT
  146.