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

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5. Lines=9
  6. 01=Import To Stills
  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 creates flyer
  11. 06=stills from them. This makes it very
  12. 07=easy to take frames and convert them
  13. 08=into stills which take up less space 
  14. 09=on your Hard Drive & load much faster.
  15.  
  16. */
  17.  
  18. parse arg InFile FileNum TotalNum FrameRepeat WhichScript TotalScript Times Select
  19. signal on error
  20. signal on syntax
  21. options results
  22.  
  23. InFile = Translate(InFile," ","ยค")
  24. DriveName = FindDrive()
  25. TempDir = FindTemp()
  26. TempDirFile = TempDir"CT-Temp"
  27.  
  28. if FileNum = 1 & WhichScript = 1 then do
  29.     Address CT_1 GetCompressionNT
  30.     Compression = result
  31.     address command "C:Assign HIIP: Toaster:Programs/hiip_support"
  32.     Type = YesOrNo("Use FileNames Or Select New Names For Stills?"," FILENAME "," NEW NAME ")
  33.     if Type = 1 then do
  34.         do i = 1 to Times
  35.             blank = "Select Path For Stills Collection #"i"!"
  36.             OutFile.i = GetPath(blank,DriveName)
  37.             DriveName = GetPathName(OutFile.i)
  38.             end
  39.         end
  40.     else do
  41.         OutFile.1 = "NewName"
  42.         do i = 1 to TotalNum
  43.             x = i-1
  44.             Address CT_1 GetScriptFileName x
  45.             Name = result 
  46.             NewName = GetFileName(Name)
  47.             blank = "Enter New Name For "NewName"!"
  48.             StillName.i = GetFile(blank,DriveName)
  49.             NewName = GetFileName(StillName.i)
  50.             if NewName = "" then do
  51.                 Address CT_1 OK_TEXT " OK "
  52.                 Title = "You Must Enter A Valid Path & Name For Stills!"
  53.                 Address CT_1 FYINT Title
  54.                 Address CT_1 Abort
  55.                 Address CT_1 Quit
  56.                 exit
  57.                 end
  58.  
  59.             end
  60.         end
  61.     if OutFile.1 = "" then do
  62.         Address CT_1 OK_TEXT " OK "
  63.         Title = "You Must Enter A Valid Path For Stills!"
  64.         Address CT_1 FYINT Title
  65.         Address CT_1 Abort
  66.         Address CT_1 Quit
  67.         exit
  68.         end
  69.     call open TempFile,"RAM:CT-ITS",W
  70.     call writeln TempFile,Compression
  71.     call writeln TempFile,Type
  72.     do i = 1 to Times
  73.         call writeln TempFile,OutFile.i
  74.         end
  75.     if Type = 0 then do
  76.         do i = 1 to TotalNum
  77.             call writeln TempFile,StillName.i
  78.             end
  79.         end
  80.     call close TempFile
  81.     end
  82. else do
  83.     call open TempFile,"RAM:CT-ITS",R
  84.     line = readln(TempFile)
  85.     parse var line Compression
  86.     line = readln(TempFile)
  87.     parse var line Type
  88.     do i = 1 to Times
  89.         line = readln(TempFile)
  90.         parse var line OutFile.i
  91.         OutFile.i = strip(OutFile.i)
  92.         end
  93.     if Type = 0 then do
  94.         do i = 1 to TotalNum
  95.             line = readln(TempFile)
  96.             parse var line StillName.i
  97.             StillName.i = strip(StillName.i)
  98.             end
  99.         end
  100.     call close TempFile
  101.     end
  102.  
  103. InFile = strip(InFile)
  104. Select = strip(Select)
  105. if Times = 1 then Select = 1
  106.  
  107. TOASTERLIB="ToasterARexx.port"
  108. call remlib(TOASTERLIB)
  109. call remlib('PROJECT_REXX_PORT')
  110. call addlib('PROJECT_REXX_PORT' , 0)
  111. call addlib(TOASTERLIB,0)
  112.  
  113. call Routine
  114.  
  115. call remlib('PROJECT_REXX_PORT')
  116. call remlib('ToasterARexx.port')
  117. exit
  118.  
  119.  
  120.  
  121.  
  122.  
  123. YesOrNo: procedure
  124.     parse Arg Title,Yes,No
  125.     Address CT_1 OK_TEXT Yes
  126.     Address CT_1 CANCEL_TEXT No
  127.     Address CT_1 AskYesNoNT Title
  128.     if result = "OK" then YesNo = 1
  129.     else YesNo = 0
  130. return YesNo
  131.  
  132. GetFileName: procedure  
  133.    ARG CompleteName
  134.    c = lastpos("/",CompleteName)
  135.    if c = 0 then c = lastpos(":",CompleteName)
  136.    return substr(CompleteName, c + 1)
  137.  
  138.  
  139. GetPathName: procedure  
  140.    ARG CompleteName
  141.    c = lastpos(":",CompleteName)
  142.    if c = 0 then c = lastpos(":",CompleteName)
  143.    return left(CompleteName,c)
  144.  
  145. GetPath:
  146.     parse Arg Title, Path
  147.     Address CT_1 SetString Path
  148.     Address CT_1 GetPathNameNT Title
  149. return result
  150.  
  151.  
  152. GetFile:
  153.     parse Arg Title, Path
  154.     Address CT_1 SetString Path
  155.     Address CT_1 GetFileNameNT Title
  156. return result
  157.  
  158. Routine:
  159.     call Switcher(MDV1)
  160.     call Switcher(PDV1)
  161.     TempName = TempDirFile
  162.     Address CT_1 OpenMessageNT "Gnusto Program Is Now Converting File!"
  163.     Address command "C:gnusto >NIL: "InFile" "TempName" image saver iff sy "value(0)" sx "value(752)" sn bestup"
  164.     Address CT_1 CloseMessageNT
  165.         call Switcher(LRGB,value("TempName"),0)
  166.     Address CT_1 UpDate
  167.     if result = 0 then do
  168.         Address CT_1 Abort
  169.         Address CT_1 Quit
  170.         end
  171.     Address command "Delete >NIL: "TempDirFile
  172.  
  173.  
  174.     OutName = GetFileName(InFile)
  175.     NewName = OutFile.Select""OutName
  176.     i = FileNum
  177.     if Type = 0 then NewName = StillName.i
  178.         call RecordAdd(NewName,4,6,Compression)
  179.     Address CT_1 UpDate
  180.     if result = 0 then do
  181.         Address CT_1 Abort
  182.         Address CT_1 Quit
  183.         end
  184.     call MakeIcon(NewName,,'STILL')
  185.  
  186.     if FileNum = TotalNum then do
  187.         address command "Delete >NIL: RAM:CT-ITS"
  188.         end
  189.     Address CT_1 Quit
  190. return
  191.  
  192. FindDrive:
  193.     address command "C:Info >RAM:CT-List"
  194.     call open TempFile,"RAM:CT-List",R
  195.     do until eof(TempFile)
  196.         line = readln(TempFile)
  197.         parse var line Drive" "Rest
  198.         if Drive = "FA0:" then 
  199.             Volume = word(Rest,7)":"
  200.     end
  201.     call close TempFile
  202. return Volume
  203.  
  204. FindTemp:
  205.     call open TempFile,"RAM:CT-Dir",R
  206.     TempPath = readln(TempFile)
  207.     call close TempFile
  208. return TempPath
  209.  
  210. syntax:
  211. error:
  212.     Address CT_1 OK_TEXT " OK "
  213.     Title = "An Error Was Found With This Script On Line #"SIGL"!"
  214.     Address CT_1 CloseMessageNT
  215.     Address CT_1 FYINT Title
  216.     Address CT_1 Abort
  217.     Address CT_1 Quit
  218. exit
  219.  
  220.