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

  1. /*
  2. ** SaveAsBMP.fred
  3. **
  4. ** $VER: SaveAsBMP.fred 1.4.0 (24.10.93)
  5. **
  6. ** This program can be run from an InvokeADPro list to save images in
  7. ** BMP format.  Including this program automatically causes a pre script
  8. ** to be executed as well (to select the BMP file extension).
  9. **
  10. ** It is up to the user to include the necessary scripts to create raw or
  11. ** rendered data.  This script will only try to save out what you tell it,
  12. ** and not do any error detecting regarding what type of image data is
  13. ** available.
  14. **
  15. ** Clips Imported:
  16. **    FREDBMPSaveType        -    Image type to save
  17. **    FREDBMPFNameSelect    -    String describing how the filename
  18. **                    should be modified
  19. **    FREDBMPSeqFileSelect    -    FRED sequence file to create
  20. **
  21. ** NOTE: Clip names are case sensitive.
  22. **
  23. ** This script requires FRED v1.4.0 (or higher) to run.  Also required is
  24. ** ADPro v2.5.0 (or higher).
  25. **
  26. ** Copyright © 1992-1993 ASDG, Incorporated
  27. ** All Rights Reserved
  28. */
  29.  
  30.  
  31. ADDRESS "ADPro"
  32. OPTIONS RESULTS
  33.  
  34. PARSE ARG FrameNum FrameFName Length LoadFlag FirstCallSeq FirstCallCell
  35.  
  36. NL = '0A'X
  37. SQ = '27'X
  38. DQ = '22'X
  39. TRUE  = 1
  40. FALSE = 0
  41.  
  42. FrameFName = STRIP(STRIP(FrameFName , "B" , " ") , "B" , '"')
  43.  
  44.  
  45. /*
  46. ** Get the required parameters.  Error if any are missing.
  47. */
  48.  
  49. SaveType = GETCLIP( "FREDBMPSaveType" )
  50. IF (SaveType = "") THEN DO
  51.     ADPRO_TO_FRONT
  52.     OKAY1 "Required clip, FREDBMPSaveType," || NL ||,
  53.         "is not specified."
  54.     SCREEN_TO_FRONT "FRED"
  55.     EXIT 10
  56. END
  57.  
  58. FNameSelect = GETCLIP( "FREDBMPFNameSelect" )
  59. IF (FNameSelect = "") THEN DO
  60.     ADPRO_TO_FRONT
  61.     OKAY1 "Required clip, FREDBMPFNameSelect," || NL ||,
  62.         "is not specified."
  63.     SCREEN_TO_FRONT "FRED"
  64.     EXIT 10
  65. END
  66.  
  67. SeqFileSelect = GETCLIP( "FREDBMPSeqFileSelect" )
  68. IF (SeqFileSelect = "") THEN DO
  69.     ADPRO_TO_FRONT
  70.     OKAY1 "Required clip, FREDBMPSeqFileSelect," || NL ||,
  71.         "is not specified."
  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. IF (SaveType = "RAW") THEN DO
  82.     CALL "FREDSCRIPTS:FREDFunctions/CheckForRawImageData" TRUE
  83.     IF (RESULT ~= 0) THEN
  84.         EXIT 10
  85. END
  86. ELSE IF ((SaveType = "IMAGE") | (SaveType = "SCREEN")) THEN DO
  87.     CALL "FREDSCRIPTS:FREDFunctions/CheckForRenderedImageData" TRUE
  88.     IF (RESULT ~= 0) THEN
  89.         EXIT 10
  90. END
  91.  
  92.  
  93. /*
  94. ** Do the save.  If we aren't using the same filename, we will use the
  95. ** same basename and make every effort possible to replace the
  96. ** perceived filename extension with the selected BMP extension.
  97. */
  98.  
  99. CALL "FREDSCRIPTS:FREDFunctions/ModifyFilename" FNameSelect '"'FrameFName'"' FrameNum FALSE
  100. NewFName = '"'RESULT'"'
  101.  
  102. SAVER "BMP" NewFName SaveType
  103. IF (RC ~= 0) THEN DO
  104.     Why = ADPRO_RESULT
  105.     ADPRO_TO_FRONT
  106.     OKAY1 "BMP save failed:" || NL || Why || NL ||,
  107.         "Argument Information:" || NL ||,
  108.         "FileName = " || NewFName || NL ||,
  109.         "Type = " || SaveType
  110.     SCREEN_TO_FRONT "FRED"
  111.     EXIT 10
  112. END
  113.  
  114. CALL "FREDSCRIPTS:FREDFunctions/SeqFileAppend" SeqFileSelect NewFName 1
  115.  
  116. EXIT 0
  117.