home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Misc / EDG-CT1.DMS / in.adf / CT.run / Macros / GPI_Croutons.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-10-09  |  3.4 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. CR = '0A'x
  11.  
  12. Main:
  13. call OpenStuff()
  14. call Docs()
  15. call Routine()
  16. call CloseStuff()
  17. exit
  18. return
  19.  
  20. GetFile:
  21.     parse Arg Title, Path
  22.     Address FLY_1 SetString Path
  23.     Address FLY_1 GetFileNameNT Title
  24. return result
  25.  
  26.  
  27. GetPath:
  28.     parse Arg Title, Path
  29.     Address FLY_1 SetString Path
  30.     Address FLY_1 GetPathNameNT Title
  31. return result
  32.  
  33. GetText:
  34.     parse Arg Title, Text
  35.     Address FLY_1 SetString Text
  36.     Address FLY_1 GetStringNT Title
  37. return result
  38.  
  39.  
  40. OpenStuff:
  41.     address command "run CT:FLY"
  42.     do while (POS('FLY_1',SHOW('Ports')) = 0)
  43.         address command "wait 1"
  44.         end
  45.     TOASTERLIB="ToasterARexx.port"
  46.     call remlib('ToasterARexx.port')
  47.     call remlib('PROJECT_REXX_PORT')
  48.     call addlib('PROJECT_REXX_PORT' , 0)
  49.     call addlib(TOASTERLIB,0)
  50. return
  51.  
  52. CloseStuff:
  53.     Address FLY_1 Quit
  54.     call remlib('ToasterARexx.port')
  55.     call remlib('PROJECT_REXX_PORT')
  56.     exit
  57. return
  58.  
  59. YesOrNo: procedure
  60.     parse Arg Title,Yes,No
  61.     Address FLY_1 OK_TEXT Yes
  62.     Address FLY_1 CANCEL_TEXT No
  63.     Address FLY_1 AskYesNoNT Title
  64.     if result = "OK" then YesNo = 1
  65.     else YesNo = 0
  66. return YesNo
  67.  
  68. Info: 
  69.     parse Arg Title,Yes
  70.     Address FLY_1 OK_TEXT Yes
  71.     Address FLY_1 FYINT Title
  72. return
  73.  
  74. FindDrive:
  75.     address command "C:Info >RAM:FLY-List"
  76.     call open TempFile,"RAM:FLY-List",R
  77.     do until eof(TempFile)
  78.         line = readln(TempFile)
  79.         parse var line Drive" "Rest
  80.         if Drive = "FA0:" then 
  81.             Volume = word(Rest,7)":"
  82.     end
  83.     call close TempFile
  84.     address command "Delete >NIL: RAM:FLY-List"
  85. return Volume
  86.  
  87. GetFileName: procedure  
  88.    ARG CompleteName
  89.    c = lastpos("/",CompleteName)
  90.    if c = 0 then c = lastpos(":",CompleteName)
  91.    return substr(CompleteName, c + 1)
  92.  
  93.  
  94. GetPathName: procedure  
  95.    ARG CompleteName
  96.    c = lastpos(":",CompleteName)
  97.    if c = 0 then c = lastpos(":",CompleteName)
  98.    return left(CompleteName,c)
  99.  
  100. Docs:
  101. Answer = YesOrNo(" Do You Need Instructions?"," YES "," NO ")
  102. if Answer = 0 then return 
  103. Text = "This Macro will wait for a GPI pulse out of\
  104. the Second Mouse Port then play a crouton in\
  105. the current project. It then waits until the\
  106. trigger is hit again and plays the next. It\
  107. continues until all the croutons have been\
  108. played. This can be handy for playing foley\
  109. type sound effects in real time.\
  110.  \
  111. To Abort Hit Control C then the GPI button!"
  112. Answer = YesOrNo(Text," Continue "," Exit ")
  113. if Answer = 0 then call CloseStuff()
  114.  
  115. return
  116.  
  117.  
  118. Routine:
  119.     start_loc=croutonspot()
  120.     call croutonpick(LAST)
  121.     project_end=croutonspot()
  122.     call croutonpick(FIRST)
  123.     current_spot=0
  124.     call Switcher(SGPI,POS)
  125.     if ~open('Window','RAW:'0'/'0'/'640'/'150'/Control Tower - Hit Control-C to Abort/NOSIZE/SCREEN','W') then do
  126.         address FYI_1 Quit
  127.             exit
  128.         end
  129.     do while (current_spot<project_end+1)
  130.            call croutonpick(current_spot)
  131.            current_spot=current_spot+1
  132.         Name = croutongettag(OriginalLocation)
  133.           call writech('Window',"Playing "Name""CR)
  134.         call Switcher(WAIT,GPI)
  135.         call CroutonStop()
  136.         call CroutonRun(Name)
  137.            end
  138.     call croutonpick(start_loc)
  139.     Address FLY_1 OK_TEXT " OK "
  140.     Address FLY_1 FYINT "All Croutons Have Been Played!"
  141. return
  142.  
  143.  
  144. syntax:
  145. error:
  146.     Address FLY_1 OK_TEXT " OK "
  147.     Title = "An Error Was Found With This Macro On Line #"SIGL"!"
  148.     if SIGL ~= 133 & SIGL ~= 15 then
  149.         Address FLY_1 FYINT Title
  150.     else
  151.         Address FLY_1 FYINT "Macro Has Been Aborted!"
  152.     Address FLY_1 Quit
  153. exit
  154.