home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Scripts / 2 / Frames / Clips / FramesToClip next >
Encoding:
Text File  |  1995-08-16  |  4.0 KB  |  192 lines

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5. Lines=6
  6. 01=Frames To Clip
  7. 02= 
  8. 03=This script will take individual frames,
  9. 04=load them into Toaster Paint then process
  10. 05=whatever options the user selects then save
  11. 06=them out as a Flyer Clip.
  12.  
  13. */
  14.  
  15. parse arg InFile FileNum TotalNum FrameRepeat WhichScript TotalScript Times Select
  16. signal on error
  17. signal on syntax
  18. options results
  19. InFile = Translate(InFile," ","ยค")
  20. DriveName = FindDrive()
  21.  
  22. if FileNum = 1 & WhichScript = 1 then do
  23.     Address "DigiPaint"
  24.     Address command "C:Wait 2"
  25.     Address CT_1 ScreenToFront
  26.     FrameField = YesOrNo("Select Frame Or Field Format?"," FRAME "," FIELD ")
  27.     Address CT_1 SetString "CT:Scripts2/2/"
  28.     Address CT_1 GetMultiName "Select Options (Hold Shift Key Down For Multiple Process!)      "
  29.     do i = 1 to Times
  30.         blank = "Select Path & Name For Clip #"i"!"
  31.         OutFile.i = GetFile(blank,DriveName)
  32.         end
  33.     Name = GetFileName(OutFile.1)
  34.     if Name = "" then do
  35.         Address CT_1 OK_TEXT " OK "
  36.         Title = "You Must Enter A Valid Name For Clip!"
  37.         Address CT_1 FYI Title
  38.         Address CT_1 Abort
  39.         Address CT_1 Quit
  40.         exit
  41.         end
  42.     call open TempFile,"RAM:CT-TP",W
  43.     call writeln TempFile,FrameField
  44.     do i = 1 to Times
  45.         call writeln TempFile,OutFile.i
  46.         end
  47.     call close TempFile
  48.     end
  49. else do
  50.     call open TempFile,"RAM:CT-TP",R
  51.     line = readln(TempFile)
  52.     parse var line FrameField
  53.     do i = 1 to Times
  54.         line = readln(TempFile)
  55.         parse var line OutFile.i
  56.         OutFile.i = strip(OutFile.i)
  57.         end
  58.     call close TempFile
  59.     end
  60.  
  61. InFile = strip(InFile)
  62. Select = strip(Select)
  63. if Times = 1 then Select = 1
  64.  
  65. call Routine
  66.  
  67. exit
  68.  
  69.  
  70. GetFileName: procedure  
  71.    ARG CompleteName
  72.    c = lastpos("/",CompleteName)
  73.    if c = 0 then c = lastpos(":",CompleteName)
  74.    return substr(CompleteName, c + 1)
  75.  
  76.  
  77. GetPathName: procedure  
  78.    ARG CompleteName
  79.    c = lastpos(":",CompleteName)
  80.    if c = 0 then c = lastpos(":",CompleteName)
  81.    return left(CompleteName,c)
  82.  
  83. GetFile:
  84.     parse Arg Title, Path
  85.     Address CT_1 SetString Path
  86.     Address CT_1 GetFileName Title
  87. return result
  88.  
  89.  
  90. YesOrNo: procedure
  91.     parse Arg Title,Yes,No
  92.     Address CT_1 OK_TEXT Yes
  93.     Address CT_1 CANCEL_TEXT No
  94.     Address CT_1 AskYesNo Title
  95.     if result = "OK" then YesNo = 2
  96.     else YesNo = 1
  97. return YesNo
  98.  
  99.  
  100. SaveClip: procedure
  101.   arg file
  102.   'Sacp'
  103.   dirname=GetPathName(file)
  104.   'Dnam'dirname
  105.   filename=GetFileName(file)
  106.   'Fnam'filename
  107.   'Okls' 
  108. return
  109.  
  110. Routine:
  111.     Address "DigiPaint"
  112.     if Select = 1 then do
  113.         call open TempFile,"RAM:CT-TEMP",W
  114.         call writeln TempFile,Select
  115.         call close TempFile
  116.         Set = 1
  117.         end
  118.     else do
  119.         Set = 0
  120.         call open TempFile,"RAM:CT-TEMP",R
  121.         line = readln(TempFile)
  122.         parse var line TempNum
  123.         call close TempFile
  124.         if TempNum ~= Select then do
  125.             Set = 1
  126.             call open TempFile,"RAM:CT-TEMP",W
  127.             call writeln TempFile,Select
  128.             call close TempFile
  129.             'Iclp'
  130.             end
  131.         end
  132.  
  133.     Address CT_1 ScreenToFront
  134.     if Set = 1 then
  135.         call SaveClip(OutFile.Select)
  136.     if WhichScript = 1 then
  137.         'Aloa'InFile
  138.     call SubRoutine(FileNum,TotalNum)
  139.     if WhichScript = TotalScript then do
  140.         do i = 1 to  FrameRepeat
  141.             do j = 1 to  FrameField
  142.                     'Apfc'
  143.                     'Apfc'
  144.                 end
  145.             end
  146.         end
  147.     if FileNum = TotalNum then do
  148.         if WhichScript = TotalScript then do
  149.             'Iclp'
  150.             address command "Delete >NIL: RAM:CT-TP"
  151.             address command "Delete >NIL: RAM:CT-TEMP"
  152.             end
  153.         end
  154.     Address CT_1 Quit
  155.  
  156. return
  157.  
  158. FindDrive:
  159.     address command "C:Info >RAM:CT-List"
  160.     call open TempFile,"RAM:CT-List",R
  161.     do until eof(TempFile)
  162.         line = readln(TempFile)
  163.         parse var line Drive" "Rest
  164.         if Drive = "FA0:" then 
  165.             Volume = word(Rest,7)":"
  166.     end
  167.     call close TempFile
  168. return Volume
  169.  
  170.  
  171. SubRoutine:
  172.     parse Arg Num,TotalNum
  173.     call open TempFile,"Ram:CT-LIST",R
  174.     do until eof(TempFile)
  175.         DoIt = readln(TempFile)
  176.         if DoIt ~= "" then
  177.             address command "SYS:rexxc/rx >NIL: "DoIt" "Num" "TotalNum
  178.         end
  179.     call close TempFile
  180. return
  181.  
  182.  
  183. syntax:
  184. error:
  185.     Address CT_1 OK_TEXT " OK "
  186.     Title = "An Error Was Found With This Script On Line #"SIGL"!"
  187.     Address CT_1 FYI Title
  188.     Address CT_1 Abort
  189.     Address CT_1 Quit
  190. exit
  191.  
  192.