home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / GFX / ADPro251-3.DMS / ADPro251-3.adf / FREDScripts.lha / FREDSavers / SaveAsGIF.fred < prev    next >
Encoding:
Text File  |  1994-01-31  |  2.4 KB  |  110 lines

  1. /*
  2. ** SaveAsGIF.fred
  3. **
  4. ** $VER: SaveAsGIF.fred 1.2.0 (24.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to save images in
  7. ** GIF format.  Including this program automatically causes a pre script
  8. ** to be executed as well (to select the GIF file extension).
  9. **
  10. ** Clips Imported:
  11. **    FREDGIFFNameSelect    -    String describing how the filename
  12. **                    should be modified
  13. **    FREDGIFSeqFileSelect    -    Name of sequence file
  14. **
  15. ** NOTE: Clip names are case sensitive.
  16. **
  17. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  18. ** ADPro v2.5.0 (or higher).
  19. **
  20. ** Copyright © 1992-1993 ASDG, Incorporated
  21. ** All Rights Reserved
  22. */
  23.  
  24.  
  25. ADDRESS "ADPro"
  26. OPTIONS RESULTS
  27.  
  28. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  29.  
  30. NL = '0A'X
  31. SQ = '27'X
  32. DQ = '22'X
  33. TRUE  = 1
  34. FALSE = 0
  35.  
  36. FrameFName = STRIP(STRIP(FrameFName , "B" , " ") , "B" , '"')
  37.  
  38.  
  39. /*
  40. ** Get the required parameters.  Error if any are missing.
  41. */
  42.  
  43. FNameSelect = GETCLIP( "FREDGIFFNameSelect" )
  44. IF (FNameSelect = "") THEN DO
  45.     ADPRO_TO_FRONT
  46.     OKAY1 "Required clip, FREDGIFFNameSelect," || NL ||,
  47.         "is not specified."
  48.     SCREEN_TO_FRONT "FRED"
  49.     EXIT 10
  50. END
  51.  
  52. SeqFileSelect = GETCLIP( "FREDGIFSeqFileSelect" )
  53. IF (SeqFileSelect = "") THEN DO
  54.     ADPRO_TO_FRONT
  55.     OKAY1 "Required clip, FREDGIFSeqFileSelect," || NL ||,
  56.         "is not specified."
  57.     SCREEN_TO_FRONT "FRED"
  58.     EXIT 10
  59. END
  60.  
  61.  
  62. /*
  63. ** Make sure there is 256 color rendered data available.  Error if there isn't.
  64. */
  65.  
  66. RENDER_TYPE 256
  67. EXECUTE
  68. IF (RC ~= 0) THEN DO
  69.     ADPRO_TO_FRONT
  70.     OKAY1 "Could not render with" || NL ||,
  71.         "256 colors."
  72.     SCREEN_TO_FRONT "FRED"
  73.     EXIT 10
  74. END
  75.  
  76.  
  77. /*
  78. ** See what type of data is loaded in ADPro/MorphPlus.
  79. */
  80.  
  81. CALL "FREDSCRIPTS:FREDFunctions/CheckForRenderedImageData" TRUE
  82. IF (RESULT ~= 0) THEN
  83.     EXIT 10
  84.  
  85.  
  86. /*
  87. ** Do the save.  If we aren't using the same filename, we will use the
  88. ** same basename and make every effort possible to replace the
  89. ** perceived filename extension with the selected GIF extension.
  90. */
  91.  
  92. CALL "FREDSCRIPTS:FREDFunctions/ModifyFilename" FNameSelect '"'FrameFName'"' FrameNum FALSE
  93. NewFName = '"'RESULT'"'
  94.  
  95. SAVER "GIF" NewFName "IMAGE"
  96. IF (RC ~= 0) THEN DO
  97.     Why = ADPRO_RESULT
  98.     ADPRO_TO_FRONT
  99.     OKAY1 "GIF save failed:" || NL || Why || NL ||,
  100.         "Argument Information:" || NL ||,
  101.         "Filename = " || NewFName || NL ||,
  102.         "Type = " || "IMAGE"
  103.     SCREEN_TO_FRONT "FRED"
  104.     EXIT 10
  105. END
  106.  
  107. CALL "FREDSCRIPTS:FREDFunctions/SeqFileAppend" SeqFileSelect NewFName 1
  108.  
  109. EXIT 0
  110.