home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Scripts / 2 / Frames / Clips / ImportToClip < prev   
Encoding:
Text File  |  1995-08-24  |  4.8 KB  |  216 lines

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