home *** CD-ROM | disk | FTP | other *** search
/ The Best of Mecomp Multimedia 2 / MECOMP-CD-II.iso / amiga / sound / mrmpeg / dropinsert.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1998-03-06  |  3.2 KB  |  85 lines

  1. /* DropInsert.rexx */
  2.  
  3. options results; address MrMPEG; signal on syntax; parse arg temp_list
  4.  
  5. MUIA_List_Active    = 0x8042391c;    MUIA_List_Entries    = 0x80421654
  6. MUIA_Window_Sleep    = 0x8042e7db;    MUIV_List_Active_Top    = -2
  7. MUIV_List_Insert_Active = -1;        MUIV_List_Insert_Bottom = -3
  8. MUIV_List_Insert_Sorted = -2
  9.  
  10. window ID WIND1 ATTRS MUIA_Window_Sleep 1
  11. window ID WIND2 ATTRS MUIA_Window_Sleep 1
  12. list ID SLIST ATTRS MUIA_List_Entries; entries = result
  13. if temp_list ~= "" then do
  14.   do forever
  15.     parse var temp_list first ',' temp_list
  16.     if first == '' then leave
  17.     if exists(first) then do
  18.       popasl ID PATH; pathname = result
  19.       temp_name = TmpFile('PIPE:MPEG_Temp.')
  20.       address command '"'pathname'MPEGA" -h "'first'" >'temp_name
  21.       if open('Output', temp_name, 'r') = 1 then do
  22.         null = readln('Output')
  23.         null = readln('Output')
  24.         null = readln('Output')
  25.         null = readln('Output')
  26.         info = readln('Output')
  27.         length = readln('Output')
  28.         call close('Output')
  29.         if left(info, 13) = '   File Type:' then do
  30.           parse var info dummy':' ''detail''
  31.           parse var length dummy':' ''temp_total_time''
  32.           list ID SLIST ATTRS MUIA_List_Active
  33.           if entries = 0 then
  34.             list ID SLIST INSERT POS MUIV_List_Insert_Bottom,
  35.               STRING first","temp_total_time","strip(detail)
  36.           else do
  37.             list ID SLIST ATTRS MUIA_List_Entries; temp_max = result
  38.             skip = 0
  39.             do i = 0 to temp_max - 1
  40.               list ID SLIST POS i
  41.               parse var result temp_name','dummy
  42.               if first = temp_name then do
  43.                 skip = 1
  44.                 break
  45.               end
  46.             end
  47.             if ~skip then
  48.               list ID SLIST INSERT POS MUIV_List_Insert_Active,
  49.                 STRING first","temp_total_time","strip(detail)
  50.           end
  51.         end /* of if left */
  52.         else request ID WARN GADGETS '"OK"' '"Corrpted MPEG file."'
  53.       end /* of if open */
  54.       else request ID WARN GADGETS '"OK"' '"Could not open a pipe."'
  55.     end /* of if exists */
  56.     else do
  57.       temp_string = "Could not open the file '"first"'."
  58.       request ID WARN GADGETS '"OK"' temp_string
  59.     end
  60.   end /* of do forever */
  61.   list ID SLIST ATTRS MUIA_List_Entries; temp_max = result
  62.   setvar max temp_max
  63.   text ID MAX LABEL "\033b\033r"right(temp_max, 3)
  64.   temp_total_time = 0
  65.   do i = 0 to temp_max - 1
  66.     list ID SLIST POS i
  67.     parse var result dummy','temp_song_time','dummy2
  68.     temp_total_time = temp_total_time + left(temp_song_time, 2) * 60 + right(temp_song_time, 2)
  69.   end
  70.   temp_string = right(temp_total_time % 3600, 2, 0)||":"||,
  71.       right(temp_total_time // 3600 % 60, 2, 0)":"right(temp_total_time // 60, 2, 0)
  72.   setvar total_time temp_string
  73.   text ID TOTAL LABEL "\033b\033r"temp_string
  74.   if entries = 0 then list ID SLIST ATTRS MUIA_List_Active MUIV_List_Active_Top
  75. end /* of if temp_list */
  76. window ID WIND2 ATTRS MUIA_Window_Sleep 0
  77. window ID WIND1 ATTRS MUIA_Window_Sleep 0
  78. return
  79.  
  80. syntax:
  81.   request ID WARN GADGETS '"OK"' '"\033b\033cError 'RC' in line 'SIGL':\033n\012\033c'errortext(RC)'"'
  82.   window ID WIND2 ATTRS MUIA_Window_Sleep 0
  83.   window ID WIND1 ATTRS MUIA_Window_Sleep 0
  84.   return
  85.