home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Macros / Butt_Audio_Clips.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-10-09  |  3.1 KB  |  154 lines

  1. /*
  2.                         Control Tower Arexx Script
  3.                            Written By J.L. White
  4.                          (C)1995 Merlin's Software
  5. */
  6.  
  7. signal on error
  8. signal on syntax
  9. Options Results
  10.  
  11. Main:
  12. call OpenStuff()
  13. call Docs()
  14. call Routine()
  15. call CloseStuff()
  16. exit
  17. return
  18.  
  19. GetFile:
  20.     parse Arg Title, Path
  21.     Address FLY_1 SetString Path
  22.     Address FLY_1 GetFileNameNT Title
  23. return result
  24.  
  25.  
  26. GetPath:
  27.     parse Arg Title, Path
  28.     Address FLY_1 SetString Path
  29.     Address FLY_1 GetPathNameNT Title
  30. return result
  31.  
  32. GetText:
  33.     parse Arg Title, Text
  34.     Address FLY_1 SetString Text
  35.     Address FLY_1 GetStringNT Title
  36. return result
  37.  
  38.  
  39. OpenStuff:
  40.     address command "run CT:FLY"
  41.     address command "wait 1"
  42.     TOASTERLIB="ToasterARexx.port"
  43.     call remlib('ToasterARexx.port')
  44.     call remlib('PROJECT_REXX_PORT')
  45.     call addlib('PROJECT_REXX_PORT' , 0)
  46.     call addlib(TOASTERLIB,0)
  47. return
  48.  
  49. CloseStuff:
  50.     Address FLY_1 Quit
  51.     call remlib('ToasterARexx.port')
  52.     call remlib('PROJECT_REXX_PORT')
  53.     exit
  54. return
  55.  
  56. YesOrNo: procedure
  57.     parse Arg Title,Yes,No
  58.     Address FLY_1 OK_TEXT Yes
  59.     Address FLY_1 CANCEL_TEXT No
  60.     Address FLY_1 AskYesNoNT Title
  61.     if result = "OK" then YesNo = 1
  62.     else YesNo = 0
  63. return YesNo
  64.  
  65. Info: 
  66.     parse Arg Title,Yes
  67.     Address FLY_1 OK_TEXT Yes
  68.     Address FLY_1 FYINT Title
  69. return
  70.  
  71. FindDrive:
  72.     address command "C:Info >RAM:FLY-List"
  73.     call open TempFile,"RAM:FLY-List",R
  74.     do until eof(TempFile)
  75.         line = readln(TempFile)
  76.         parse var line Drive" "Rest
  77.         if Drive = "FA0:" then 
  78.             Volume = word(Rest,7)":"
  79.     end
  80.     call close TempFile
  81.     address command "Delete >NIL: RAM:FLY-List"
  82. return Volume
  83.  
  84. GetFileName: procedure  
  85.    ARG CompleteName
  86.    c = lastpos("/",CompleteName)
  87.    if c = 0 then c = lastpos(":",CompleteName)
  88.    return substr(CompleteName, c + 1)
  89.  
  90.  
  91. GetPathName: procedure  
  92.    ARG CompleteName
  93.    c = lastpos(":",CompleteName)
  94.    if c = 0 then c = lastpos(":",CompleteName)
  95.    return left(CompleteName,c)
  96.  
  97. Docs:
  98. Answer = YesOrNo(" Do You Need Instructions?"," YES "," NO ")
  99. if Answer = 0 then return 
  100. Text = "This Macro will take all the audio clips in a project\
  101. and set the starting points of each to butt up to the\
  102. end of the previous audio clip."
  103. Answer = YesOrNo(Text," Continue "," Exit ")
  104. if Answer = 0 then call CloseStuff()
  105.  
  106. return
  107.  
  108.  
  109. Routine:
  110.     start_loc=croutonspot()
  111.     call croutonpick(LAST)
  112.     project_end=croutonspot()
  113.     call croutonpick(FIRST)
  114.     current_spot=0
  115.     isaudio=0
  116.  
  117.     do while (current_spot<project_end+1)
  118.            call croutonpick(current_spot)
  119.            current_spot=current_spot+1
  120.            if croutontype()=" AUD" then do
  121.                   prevstart=croutongettag(Delay)
  122.                   isaudio=1
  123.                   current_temp=current_spot
  124.                   current_spot=project_end+1
  125.                   end
  126.            end
  127.  
  128.     current_spot=current_temp-1
  129.  
  130.     do while (current_spot<project_end+1)
  131.            call croutonpick(current_spot)
  132.            current_spot=current_spot+1
  133.            if croutontype()=" AUD" then do
  134.                   call croutonsettag(Delay,PrevStart)
  135.                   end
  136.            prevstart=prevstart+croutongettag(AudioDuration)
  137.            end
  138.  
  139.  
  140.     call croutonpick(start_loc)
  141.     Address FLY_1 FYINT "All Audio Has Been Adjusted!"
  142.  
  143. return
  144.  
  145.  
  146.  
  147. syntax:
  148. error:
  149.     Address FLY_1 OK_TEXT " OK "
  150.     Title = "An Error Was Found With This Macro On Line #"SIGL"!"
  151.     Address FLY_1 FYINT Title
  152.     Address FLY_1 Quit
  153. exit
  154.