home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / www / www.amiga.org / prowave / abb.lha / BlackBox.rexx < prev    next >
OS/2 REXX Batch file  |  1997-10-01  |  8KB  |  326 lines

  1. /* This is Black Box */
  2. /* Batch mode is now enabled */
  3.  
  4. OPTIONS RESULTS
  5.  
  6. call remlib('ToasterARexx.port')
  7. call remlib('PROJECT_REXX_PORT')
  8.  
  9. call addlib('PROJECT_REXX_PORT' , 0)
  10. call ADDLIB('ToasterARexx.port' , 0)
  11.  
  12. call req_error("Audio Black Box ")
  13.  
  14. IO = req_tell("BlackBox Audio Convertor", "Click Continue to Import Audio", "Click Cancel to Export Audio")
  15.  
  16. if IO = 1 then do
  17.  
  18.    call req_error("Audio Black Box --- Load various Audio formats to Flyer Drives")
  19.    
  20.    batch = req_tell("Select Mode of Import","Single File or Batch Load","Click Continue for Single File","Click Cancel for Batch Loading")
  21.  
  22.    SAY "This is Batch "
  23.    SAY batch
  24.  
  25.    if batch = 0 then do
  26.       SAY "File is Open"
  27.       OPEN(myfile,"ram:bbimport.txt",'Write')     
  28.    end
  29.  
  30.    Blackbox = 1
  31.  
  32.    do while Blackbox = 1 
  33.       count = req_tell("Import Audio to Flyer","Select Number of Input Files","Click Continue for 1 File","Click Cancel for 2 Files")
  34.  
  35.       if count = 0 then do
  36.  
  37.          rx startfilereq("Select Left Audio Source")
  38.          exit=1
  39.          do while exit=1
  40.             filename1=queryfilereq()
  41.             if filename1=0 then call quit
  42.             else NOOP
  43.             if filename1~="" then exit=0
  44.             else NOOP
  45.             address command "c:wait 1"
  46.          end
  47.          call req_close()
  48.  
  49.          rx startfilereq("Select Right Audio Source","","")
  50.          exit=1
  51.          do while exit=1
  52.             filename2=queryfilereq()
  53.             if filename2=0 then call quit
  54.             else NOOP
  55.             if filename2~="" then exit=0
  56.             else NOOP
  57.             address command "c:wait 1"
  58.          end
  59.          call req_close()
  60.       end
  61.      
  62.       if count = 1 then do
  63.          rx startfilereq("Select Audio Source")
  64.          exit=1
  65.          do while exit=1
  66.             filename1=queryfilereq()
  67.             if filename1=0 then call quit
  68.             if filename1~="" then exit=0
  69.             address command "c:wait 1"
  70.          end
  71.          call req_close()
  72.       end
  73.  
  74.       rx startfilereq("Output Filename","","")
  75.  
  76.       exit=1
  77.       do while exit=1
  78.          filename3=queryfilereq()
  79.          if filename3=0 then call quit
  80.          if filename3~="" then exit=0
  81.          address command "c:wait 1"
  82.       end
  83.  
  84.       call req_close()
  85.  
  86.       call strip 
  87.  
  88.       if batch = 1 then do
  89.          call req_open("Processing... Please Wait.")
  90.          if count = 1 then
  91.             address command  "prowave:BBWrite "||filename1||" "||filename3
  92.          else
  93.             address command "prowave:BBWrite "||filename1||" "||filename2||" "||filename3 
  94.          call req_close()
  95.          call req_error("All done.")
  96.          call remlib('ToasterARexx.port')
  97.          call remlib('PROJECT_REXX_PORT')
  98.          exit
  99.       end
  100.  
  101.       if batch = 0 then do
  102.          if count = 1 then do
  103.             SAY "Writeln is done"
  104.             WRITELN(myfile,"prowave:BBWrite "||filename1||" "||filename3);
  105.          end
  106.  
  107.          if count = 2 then do
  108.             SAY "Writeln is 3"
  109.             WRITELN(myfile,"prowave:BBWrite "||filename1||" "||filename2||" "||filename3);
  110.          end
  111.       end
  112.    
  113.       mytest = req_tell("Add Another File","Click Continue to Add File","Click Cancel to Process")
  114.  
  115.       SAY mytest
  116.  
  117.       if mytest = 0 then do
  118.          CLOSE(myfile)
  119.          SAY "We are Almost done"
  120.          address command "execute ram:bbimport.txt"
  121.          Leave
  122.       end
  123.  
  124.    end
  125. end
  126.  
  127. if IO = 0 then do
  128.  
  129.  
  130.    call req_error("Audio Black Box --- Save Flyer Audio to Various Formats")
  131.  
  132.    batch = req_tell("Select Mode of Export","Single File or Batch SAVE","Click Continue for Single File","Click Cancel for Batch Loading")
  133.  
  134.    SAY "This is Batch "
  135.  
  136.    SAY batch
  137.  
  138.    if batch = 0 then do
  139.       SAY "File is Open"
  140.       OPEN(myfile,"ram:bbexport.txt",'Write')     
  141.    end
  142.  
  143.    Blackbox = 1
  144.  
  145.    do while Blackbox = 1 
  146.  
  147.       rx startfilereq("Select Audio Source")
  148.       exit=1
  149.       do while exit=1
  150.          filename1=queryfilereq()
  151.          if filename1=0 then call quit
  152.          if filename1~="" then exit=0
  153.          address command "c:wait 1"
  154.       end
  155.       call req_close()
  156.  
  157.       count = req_tell("Export Audio from Flyer","Select Number of Output Files","Click Continue for 1 File","Click Cancel for 2 Files")
  158.  
  159.       if count = 0 then do
  160.          alpha = 2 
  161.          rx startfilereq("Left Output Filename")
  162.          exit=1
  163.          do while exit=1
  164.             filename2=queryfilereq()
  165.             if filename2=0 then call quit
  166.             else NOOP
  167.             if filename2~="" then exit=0
  168.             else NOOP
  169.             address command "c:wait 1"
  170.          end
  171.          call req_close()
  172.  
  173.          rx startfilereq("Right Output Filename","","")
  174.          exit=1
  175.          do while exit=1
  176.             filename3=queryfilereq()
  177.             if filename3=0 then call quit
  178.             else NOOP
  179.             if filename3~="" then exit=0
  180.             else NOOP
  181.             address command "c:wait 1"
  182.          end
  183.          call req_close()
  184.       end
  185.      
  186.       if count = 1 then do 
  187.  
  188.          rx startfilereq("Output Filename","","")
  189.  
  190.          exit=1
  191.          do while exit=1
  192.             filename3=queryfilereq()
  193.             if filename3=0 then call quit
  194.             if filename3~="" then exit=0
  195.             address command "c:wait 1"
  196.          end
  197.  
  198.          call req_close()  
  199.       end
  200.  
  201.       warlock2 = 0
  202.  
  203.       warlock = req_buttons("Pick Output Format",1000,"AIFF","AD516","WAV","MORE");
  204.  
  205.       if warlock = CANCEL then call quit
  206.   
  207.       if warlock = 0001 then do
  208.          warlock2 = req_buttons("Pick Output Format",1000,"RAW 16 Bit","Amiga IFF","VOC","Sun/Next AU");
  209.       end
  210.  
  211.       if warlock = 0 then call quit
  212.  
  213.       if warlock >= 1000 then
  214.          type = 1
  215.       else
  216.          if warlock >= 100 then
  217.             type = 2
  218.          else
  219.             type = 3 
  220.      
  221.       if warlock2 >= 1000 then
  222.          type = 4
  223.       else
  224.          if warlock2 >= 100 then
  225.             type = 5
  226.          else
  227.             if warlock2 >= 10 then
  228.                type = 6
  229.             else
  230.                if warlock2 > 0 then
  231.                   type = 7
  232.  
  233.      if warlock2 = CANCEL then call quit
  234.  
  235.      SAY Type   
  236.  
  237.      call strip
  238.  
  239. SAY "This is Count "||count
  240.  
  241.      if batch = 1 then do 
  242.         call req_open("Processing... Please Wait.")
  243.      
  244.         if count = 1 then do
  245.            address command  "prowave:BBRead "||type||" "||'"'||filename1||'"'||" "||'"'||filename3||'"'  
  246.         end
  247.  
  248.         if count = 0 then do
  249.            address command  "prowave:BBRead "||type||" "||'"'||filename1||'"'||" "||'"'||filename2||'"'||" "||'"'||filename3||'"'  
  250.         end
  251.      call req_close()
  252.      exit
  253.      end
  254.  
  255.    if batch = 0 then do
  256.       if count = 1 then do
  257.          WRITELN(myfile,"prowave:BBRead "||type||" "||filename1||" "||filename3);
  258.       end
  259.  
  260.       if count = 0 then do
  261.          WRITELN(myfile,"prowave:BBread "||type||" "||filename1||" "||filename2||" "||filename3);
  262.       end
  263.    
  264.       mytest = req_tell("Add Another File","Click Continue to Add File","Click Cancel to Process")
  265.  
  266.       SAY mytest
  267.  
  268.       if mytest = 0 then do
  269.          CLOSE(myfile)
  270.          SAY "We are Almost done"
  271.          address command "execute ram:bbexport.txt"
  272.          Leave
  273.       end
  274.    end
  275.  
  276. call req_close()
  277.      
  278. end
  279.  
  280. quit:
  281.    call req_error("Canceled.")
  282.    call remlib('ToasterARexx.port')
  283.    call remlib('PROJECT_REXX_PORT')
  284.    exit
  285.  
  286. strip:
  287.  
  288. say filename1
  289.  
  290. position1 = lastpos(':',filename1)
  291. position2 = lastpos(':',filename1,position1-1)
  292.  
  293. if position2 ~= 0 then do
  294.    filename1 = right(filename1,length(filename1)-position2)
  295. end 
  296.  
  297. say filename1
  298.  
  299. if alpha = 2 then do
  300.    say filename2
  301.  
  302.    position1 = lastpos(':',filename2)
  303.    if position2 ~= 0 then do
  304.       position2 = lastpos(':',filename2,position1-1)
  305.    end
  306.  
  307.    if position2 ~= 0 then do
  308.       filename2 = right(filename3,length(filename2)-position2)
  309.    end 
  310.  
  311.    say filename2
  312. end
  313.  
  314. say filename3
  315.  
  316. position1 = lastpos(':',filename3)
  317. position2 = lastpos(':',filename3,position1-1)
  318.  
  319. if position2 ~= 0 then do
  320.    filename3 = right(filename3,length(filename3)-position2)
  321. end 
  322.  
  323. say filename3
  324.  
  325. return
  326.