home *** CD-ROM | disk | FTP | other *** search
/ Amiga Elysian Archive / AmigaElysianArchive.iso / prog / arexx / scripti.lha / 3-DEE / Scripti / General / ImageIcon.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1993-05-19  |  3.4 KB  |  182 lines

  1. /*
  2. -----------------------------------------------------------------------------
  3. This AREXX Script will create an icon for an image, the width, the height
  4. and the name of the image have to be specified in the argument by the user.
  5. The Program will load the WBScreen, so it must be present.
  6. The dither to be used must also be specified in the arguments.
  7.  
  8. Host address: ADPro (Art Department Professional   ®ASDG)
  9. Written by: Jan Van Overbeke, 3-DEE, ©1993.
  10. Read the AREXX-Scripti doc for more info about operation and rights!
  11. -----------------------------------------------------------------------------
  12. */
  13.  
  14. parse arg filename iconx icony dthrnr
  15. if ~exists(filename)|filename='' then do
  16.     say 'Unable to find the image!!!!'
  17.     say 'See Ya.....'
  18.     say ''
  19.     exit
  20.     end
  21.  
  22. if iconx=0|icony=0|iconx=''|icony='' then do
  23.     say 'Iconsizes not specified! Wrong arguments'
  24.     say 'See Ya.....'
  25.     say ''
  26.     exit
  27.     end
  28.  
  29. if ~(dthrnr>-1|dthrnr<7) then do
  30.     say 'Invalid dithercode!'
  31.     say 'See Ya.....'
  32.     say ''
  33.     exit
  34.     end
  35.  
  36. address 'ADPro'
  37. options results
  38. say 'Image Icon: Written by JAN VAN OVERBEKE, 3-DEE, ©1993.'
  39. say 'IMAGE: 'filename
  40. say 'Icon size: 'iconx'x'icony
  41. say ''
  42.  
  43. /* ---- Need to load Workbench first ---- */
  44. /* ----  To know what colors it has  ---- */
  45. /* ----     and lock its palette     ---- */
  46. /* -------------------------------------- */
  47. say 'Loading WorkBench....'
  48. LFORMAT 'SCREEN'
  49. if RC~=0 then do
  50.     say 'Unable to switch to the SCREEN-Loader!'
  51.     say 'See Ya......'
  52.     say ''
  53.     exit
  54.     end
  55.  
  56. load 'Workbench Screen'
  57. if RC~=0 then do
  58.     say 'Unable to load the WorkBench-screen!'
  59.     say 'See Ya.....'
  60.     say ''
  61.     exit
  62.     end
  63.  
  64. RENDER_TYPE
  65. colors=ADPRO_RESULT
  66. if ~(colors=4|colors=2) then say 'It is advisable to only use 2 or 4 Colors!'
  67.  
  68. PSTATUS 'LOCKED'
  69. if RC~=0 then do
  70.     say 'Unable to switch the palette to locked!'
  71.     say 'See Ya.....'
  72.     say ''
  73.     exit
  74.     end
  75.  
  76. say 'Loading....'
  77. LFORMAT 'UNIVERSAL'
  78. if RC~=0 then do
  79.     say 'Unable to switch to the UNIVERSAL-Loader!'
  80.     say 'See Ya.......'
  81.     say ''
  82.     PSTATUS 'UNLOCKED'
  83.     exit
  84.     end
  85.  
  86. load filename
  87. if RC~=0 then do
  88.     say 'Unable to load the image!'
  89.     say 'See Ya......'
  90.     say ''
  91.     PSTATUS 'UNLOCKED'
  92.     exit
  93.     end
  94.  
  95. say 'Preparing Image...'
  96. dither dthrnr
  97. if RC~=0 then do
  98.     say 'Unable to switch to dither number 'dthrnr'!'
  99.     say 'See Ya.....'
  100.     say ''
  101.     PSTATUS 'UNLOCKED'
  102.     exit
  103.     end
  104.  
  105. render_type colors
  106. if RC~=0 then do
  107.     say 'Unable to switch to 'colors'!'
  108.     say 'See Ya.....'
  109.     say ''
  110.     PSTATUS 'UNLOCKED'
  111.     exit
  112.     end
  113.  
  114. ABS_SCALE iconx icony
  115. if RC~=0 then do
  116.     say 'Scale failed!'
  117.     say 'See Ya....'
  118.     say ''
  119.     PSTATUS 'UNLOCKED'
  120.     exit
  121.     end
  122.  
  123. execute
  124. if RC~=0 then do
  125.     say 'Execute failed!'
  126.     say 'See Ya.....'
  127.     say ''
  128.     PSTATUS 'UNLOCKED'
  129.     exit
  130.     end
  131.  
  132. say 'Saving IconImage....'
  133. SFORMAT 'IFF'
  134. if RC~=0 then do
  135.     say 'Unable to switch to the IFF-Saver!'
  136.     say 'See Ya.....'
  137.     say ''
  138.     PSTATUS 'UNLOCKED'
  139.     exit
  140.     end
  141.  
  142. save 'ram:IconImage' IMAGE
  143. if RC~=0 then do
  144.     say 'Error during save dummy-image to ram:'
  145.     say 'See Ya.....'
  146.     say ''
  147.     PSTATUS 'UNLOCKED'
  148.     exit
  149.     end
  150.  
  151. if ~exists('c:Brush2Icon') then do
  152.     say 'Could not find the Brush2Icon-program!'
  153.     say 'It should be found in your c: directory.'
  154.     say 'See Ya.....'
  155.     say ''
  156.     PSTATUS 'UNLOCKED'
  157.     exit
  158.     end
  159.  
  160. address COMMAND 'c:brush2icon ram:iconimage 'filename
  161. address COMMAND 'delete RAM:IconImage'
  162.  
  163. PSTATUS 'UNLOCKED'
  164. if RC~=0 then do
  165.     say 'Unable to switch the palette to unlocked!'
  166.     say 'See Ya.....'
  167.     say ''
  168.     exit
  169.     end
  170.  
  171. dither 0
  172. if RC~=0 then do
  173.     say 'Unable to switch the dither to 0 !'
  174.     say 'See Ya....'
  175.     say ''
  176.     exit
  177.     end
  178.  
  179. say 'Done.'
  180. say ''
  181. exit
  182.