home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus5 / DC-OP55B.LZX / Opus5 / arexx / PlayMod_DT.dopus5 < prev    next >
Encoding:
Text File  |  1996-06-13  |  5.1 KB  |  145 lines

  1. /* Mod-Player interface for Directory Opus 5.5
  2.    by Leo 'Nudel' Davidson for Gods'Gift Utilities
  3.    email: leo.davidson@keble.oxford.ac.uk  www: http://users.ox.ac.uk/~kebl0364
  4.  
  5. $VER: PlayMod_DT.dopus5 1.5 (13.6.96)
  6.  
  7.    This version is for use with DeliTracker by Peter Kunath & Frank Riffel
  8.    (Delirium Softdesign), but should be easy to adapt to any other player
  9.    with an ARexx port, such as MultiPlayer, EagleTracker, DMP, etc.
  10.    (In fact, a MultiPlayer version should come with this script!).
  11.  
  12.    If you include the path of a module on the command line, using {f}, only
  13.    this mod will be played. If you omit the {f}, the program will play each
  14.    selected file in the first SOURCE lister, giving you a requester to go to
  15.    the next file or stop playing.
  16.  
  17.    If the player's ARexx port is not found, the program will be run for
  18.    you (you should edit the path below). This means the script may fail if
  19.    you disable the player's ARexx port, or give an incorrect command line
  20.    to it.
  21.    If the player's ARexx port takes over a minute to appear, an error
  22.    requester will appear on the DOpus screen and the script will quit.
  23.    REMEMBER to add the "RUN" command to the player command line if it does
  24.    not automatically detach from the shell (DeliTracker doesn't)!
  25.  
  26.    If the player was running to start with, or the user selects
  27.    "Leave Playing", the module will continue playing when the script finishes.
  28.    Otherwise, the player will be quit.
  29.  
  30. Call as:
  31. ------------------------------------------------------------------------------
  32. ARexx    DOpus5:ARexx/PlayMod_DT.dopus5 {Qp} [{f}]
  33. ------------------------------------------------------------------------------
  34. Turn off all switches.
  35. "[]" means this part is optional.
  36.  
  37. //- Path to DeliTracker command --------------------------------------------*/
  38. DeliTracker = "RUN >NIL: <NIL: DH0:Tools/Music/DeliTracker_II/DeliTracker2"
  39. /*--------------------------------------------------------------------------*/
  40. options results
  41. options failat 99
  42. signal on syntax;signal on ioerr        /* Error trapping */
  43. parse arg DOpusPort FilePath
  44. DOpusPort = Strip(DOpusPort,"B",'" ')
  45. /* Important: FilePath must be stripped as below incase there is a space at
  46.               the beginning or end of the filename */
  47. FilePath = Strip(Strip(FilePath,"B",' '),"B",'"')
  48.  
  49. If DOpusPort="" THEN Do
  50.     Say "Not correctly called from Directory Opus 5!"
  51.     Say "Load this ARexx script into an editor for more info."
  52.     EXIT
  53.     END
  54. If ~Show("P",DOpusPort) Then Do
  55.     Say DOpusPort "is not a valid port."
  56.     EXIT
  57.     End
  58. Address value DOpusPort
  59.  
  60. dopus version
  61. If ( result='RESULT' | translate(result,'.',' ') < 5.1218 ) then do
  62.     dopus request '"This script requires DOpus v5.5 or greater." OK'
  63.     EXIT
  64.     end
  65.  
  66. Quit_After = "NO"
  67. If ~Show("P","DELITRACKER") Then Do
  68.     Address Command DeliTracker
  69.     Address Command "WaitForPort DELITRACKER"
  70.     Quit_After = "YES"
  71.     If ~Show("P","DELITRACKER") then do
  72.         dopus request '"Error loading DeliTracker!'|| '0a'x ||'Check its command-path in the ARexx script." OK'
  73.         EXIT
  74.         END
  75.     END
  76.  
  77. /* If file-path was specified on command line, just play that mod, else
  78.    go through all the selected ones. */
  79.  
  80. If FilePath = "" Then Do
  81.  
  82.     lister query source stem source_handle.
  83.     If source_handle.count = 0 Then Do
  84.         dopus request '"You must have a source lister" OK'
  85.         EXIT
  86.         End
  87.     lister set source_handle.0 busy 1
  88.  
  89.     lister query source_handle.0 numselentries    /* Get info about selected */
  90.     Lister_NumSelEnt = RESULT            /* entries & path to them */
  91.     lister query source_handle.0 path
  92.     Lister_Path = Strip(RESULT,"B",'"')
  93.  
  94.     Do i=1 to Lister_NumSelEnt
  95.         lister query source_handle.0 firstsel
  96.         Temp_Name = Strip(RESULT,"B",'"')
  97.         lister select source_handle.0 Temp_Name 0
  98.         Temp_Path = Lister_Path||Temp_Name
  99.         Address DELITRACKER PlayMod Temp_Path
  100.  
  101.         If Lister_NumSelEnt - i > 0 Then Do
  102.             If Quit_After = "YES" Then
  103.                 lister request source_handle.0 '"Playing module' i 'of' Lister_NumSelEnt || ':' || X2C(0A) || Temp_Name ||'" Next|Leave Playing|Stop'
  104.             Else
  105.                 lister request source_handle.0 '"Playing module' i 'of' Lister_NumSelEnt || ':' || X2C(0A) || Temp_Name ||'" Next|Leave Playing'
  106.             IF RC = "0" THEN BreakIt = "YES"
  107.             IF RC = "2" THEN Do
  108.                 BreakIt = "YES"
  109.                 Quit_After = "NO"
  110.                 END
  111.             End
  112.  
  113.         Else Do
  114.             If Quit_After = "YES" Then
  115.                 lister request source_handle.0 '"Playing module' i 'of' Lister_NumSelEnt || ':' || X2C(0A) || Temp_Name || '" Leave Playing|Stop'
  116.             Else
  117.                 lister request source_handle.0 '"Playing module' i 'of' Lister_NumSelEnt || ':' || X2C(0A) || Temp_Name || '" Leave Playing'
  118.             IF RC = "1" Then Quit_After = "NO"
  119.             End
  120.  
  121.         IF BreakIt = "YES" THEN BREAK
  122.         END
  123.     End
  124.  
  125. ELSE Do
  126.     Address DELITRACKER PlayMod FilePath
  127.     If Quit_After = "YES" Then
  128.         dopus request '"Playing module:'||X2C(0A)||FilePath'" Leave Playing|Stop'
  129.     Else
  130.         dopus request '"Playing module:'||X2C(0A)||FilePath'" Leave Playing'
  131.     IF RC ~= "0" THEN Quit_After = "NO"
  132.     End
  133.  
  134. /*-- Restore the Lister for normal use --------------------------------------*/
  135. syntax:;ioerr:                /* In case of error, jump here */
  136. END_PART_2:
  137. If FilePath = "" Then Do
  138.     lister refresh source_handle.0
  139.     lister set source_handle.0 busy 0
  140.     END
  141. END_PART:
  142. If Quit_After = "YES" Then Address DELITRACKER QUIT
  143.  
  144. EXIT
  145.