home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD1.iso / FileMover / Dopus4 / ArexxScripts / DOEPCTRL.LHA / doepctrl / DO_EP-Control.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1995-09-05  |  10.5 KB  |  544 lines

  1. /*
  2.       $VER: dIROPUS_eAGLEpLAYER_aREXX_cONTROL_sCRIPT v1.5 (05.09.94)
  3.  
  4.                               bY STuN/MYSTiC
  5.  
  6.              (tESTED wITH eAGLEpLAYER v1.52b & dIROPUS v4.11)
  7.  
  8.      This script is based on the original ones by DEFECT, but it's so
  9.      greatly improved that you'll hardly notice anything in common!
  10.      For usage infoz read the doc file included in the original LHA
  11.      archive...
  12.  
  13.      To contact me call tRACKLAND (+39-2-798035) from 22:30 to 02:30
  14.      (Italian time!)... bYE!!!
  15. */
  16.  
  17. parse arg filename   /* 'filename' is the mod filename or an argument */
  18.  
  19. options results
  20.  
  21. pausedstate=0
  22. EPactive=pos('rexx_EP',show('Ports'))  /* inactive if 0 */
  23.  
  24. address 'DOPUS.1'
  25. toptext '-    -   -  - - -+ bE pATIENT -+- - -  -   -    -'
  26.  
  27. /****** Argument: None ******/
  28. If length(filename)<1 then
  29. do
  30.  call NOARGS
  31.  exit
  32. end
  33. /****** Argument: PAUSE ******/
  34. if upper(filename)='PAUSE' then
  35. do
  36.  call PAUSE
  37.  exit
  38. end
  39. /****** Argument: REPLAY ******/
  40. if upper(filename)='REPLAY' then
  41. do
  42.  call REPLAY
  43.  exit
  44. end
  45. /****** Argument: EJECT ******/
  46. if upper(filename)='EJECT' then
  47. do
  48.  call EJECT
  49.  exit
  50. end
  51. /****** Argument: MODINFO1 ******/
  52. if upper(filename)='MODINFO1' then
  53. do
  54.  call MODINFO1
  55.  exit
  56. end
  57. /****** Argument: MODINFO2 ******/
  58. if upper(filename)='MODINFO2' then
  59. do
  60.  call MODINFO2
  61.  exit
  62. end
  63. /****** Argument: PLAYINFO ******/
  64. if upper(filename)='PLAYINFO' then
  65. do
  66.  call PLAYINFO
  67.  exit
  68. end
  69. /****** Argument: NEXTSUBSONG - PREVSUBSONG *******/
  70. if upper(filename)='NEXTSUBSONG' then
  71. do
  72.  subsongchmode=1
  73.  call CHSUBSONG
  74.  exit
  75. end
  76. if upper(filename)='PREVSUBSONG' then
  77. do
  78.  subsongchmode=2
  79.  call CHSUBSONG
  80.  exit
  81. end
  82. /****** Argument: EP2DOPUS *******/
  83. if upper(filename)='EP2DOPUS' then
  84. do
  85.  call EP2DOPUS
  86.  exit
  87. end
  88. /****** Argument: QUIT *******/
  89. if upper(filename)='QUIT' then
  90. do
  91.  call QUIT
  92.  exit
  93. end
  94. /****** Argument: Module filename (loads EP if not active) ******/
  95. if EPactive = 0 then
  96. do
  97.  address 'DOPUS.1'
  98.  busy on
  99.  checkabort
  100.  Waittime=60         /* 1 min waiting time (to see if something
  101.                         goes wrong while loading)... adapt it
  102.                         to your needs! */
  103.  toptext 'EaglePlayer not active! (Press both mouse buttons NOW to abort loading)'
  104.  call delayabort 2
  105.  if ~ Exists('EaglePlayer') then
  106.  do
  107.   toptext 'Can´t find EaglePlayer in current dir! (Check DirOpus configuration!)'
  108.   busy off
  109.   exit
  110.  end
  111.  toptext '           .o(  eAGLEpLAYER cONTROL sCRIPT bY STuN/MYSTiC  )o.           '
  112.  call delayabort 1
  113.  toptext '!wAIT!     .o(  eAGLEpLAYER cONTROL sCRIPT bY STuN/MYSTiC  )o.     !wAIT!'
  114.  busy off
  115.  address COMMAND 'EaglePlayer'  /* No need to change path here cuz the */
  116.  testflag=0                     /* 'EP Play' button does it! */
  117.  time ('R')
  118.  do while (testflag=0) & (time('E') < Waittime)
  119.   if (pos('rexx_EP',show('Ports')) ~= 0) then testflag=1
  120.  end
  121.  
  122.  if pos('rexx_EP',show('Ports')) ~= 0 then
  123.  do
  124.   toptext 'EaglePlayer loaded! Now initializing...'
  125.   address 'rexx_EP'
  126.   LittleWin      /* Possible iconify modes: LittleWin, AppItem, AppIcon */
  127.   Iconify on     /* Delete these two lines if you don't wanna iconify */
  128.   Quickstart on  /* I recommend that you leave these prefs as they are! */
  129.   LoadDir off
  130.   SongEnd off
  131.   UseSongName on
  132.   NoNewModule
  133.  end
  134.  else
  135.  do
  136.   address 'DOPUS.1'
  137.   toptext 'Error while loading EaglePlayer!'
  138.   exit
  139.  end
  140. end
  141. call GETDAMOD
  142. EPactive=pos('rexx_EP',show('Ports'))
  143. call MODINFO1
  144. exit
  145.  
  146.  
  147. /****** Routinez ******/
  148.  
  149. DELAY:
  150.  arg delaytime
  151.  time ('R')
  152.  do while time('E') < delaytime
  153.  end
  154.  delaytime=0
  155. return
  156.  
  157. DELAYABORT:
  158.  arg delaytime
  159.  time ('R')
  160.  do while time('E') < delaytime
  161.   checkabort
  162.   if result then
  163.   do
  164.    toptext 'EaglePlayer loading aborted!'
  165.    busy off
  166.    exit
  167.   end
  168.  end
  169.  delaytime=0
  170. return
  171.  
  172. GETDAMOD:
  173.  address 'DOPUS.1'
  174.  toptext 'Loading possible module '||filename
  175.  address 'rexx_EP'
  176.  LoadModule filename
  177.  aha=result
  178.  address 'DOPUS.1'
  179.  toptext 'Eagleplayer: '||aha
  180.  call delay 2
  181.  address 'rexx_EP'
  182.  call GETSTATUS
  183.  if left(upper(author),4)='STUN' then
  184.  do
  185.   address 'DOPUS.1'
  186.   toptext 'Oouuuhyeah! This is a production by STuN!!!'
  187.   call delay 2
  188.  end
  189.  if maxsubs>1 then
  190.  do
  191.   address 'DOPUS.1'
  192.   toptext 'Note: This module contains '||maxsubs||' different subsongs! (not 100% sure!)'
  193.   call delay 3
  194.  end
  195. return
  196.  
  197. NOARGS:
  198.  if EPactive=0 then
  199.  do
  200.   address 'DOPUS.1'
  201.   toptext 'No file selected for playing! (Note: EaglePlayer not yet active)'
  202.   exit
  203.  end
  204.  address 'rexx_EP'
  205.  call GETSTATUS
  206.  if (pnum>0) & (playing="no") then     /* It's paused! */
  207.  do
  208.   Play
  209.   pausedstate=1
  210.   call MODINFO1
  211.  end
  212.  else
  213.  do
  214.   address 'DOPUS.1'
  215.   toptext 'No file selected for playing!'
  216.  end
  217. return
  218.  
  219. PAUSE:
  220.  if EPactive=0 then
  221.  do
  222.   address 'DOPUS.1'
  223.   toptext 'EaglePlayer not loaded! Nothing to pause!'
  224.   exit
  225.  end
  226.  address 'rexx_EP'
  227.  call GETSTATUS
  228.  if name='RESULT' then
  229.  do
  230.   address 'DOPUS.1'
  231.   toptext 'No module loaded! Nothing to Pause!'
  232.  end
  233.  else
  234.  do
  235.   if playing="yes" then
  236.   do
  237.    Pause
  238.    address 'DOPUS.1'
  239.    toptext 'Module paused! (Select Play or Pause to continue playing!)'
  240.   end
  241.   else
  242.   do
  243.    Play
  244.    pausedstate=1
  245.    call MODINFO1
  246.   end
  247.  end
  248. return
  249.  
  250. REPLAY:
  251.  if EPactive=0 then
  252.  do
  253.   address 'DOPUS.1'
  254.   toptext 'EaglePlayer not loaded! Nothing to replay!'
  255.   exit
  256.  end
  257.  address 'rexx_EP'
  258.  call GETSTATUS
  259.  if name='RESULT' then
  260.  do
  261.   address 'DOPUS.1'
  262.   toptext 'No module loaded! Nothing to replay!'
  263.   exit
  264.  end
  265.  if restart="no" then
  266.  do
  267.   address 'DOPUS.1'
  268.   toptext 'Sorry, current replayer doesn´t support replay function!'
  269.   call delay 2
  270.   call MODINFO1
  271.  end
  272.  ReplaySong
  273.  address 'DOPUS.1'
  274.  toptext 'Replaying module from the beginning...'
  275.  call delay 2
  276.  call MODINFO1
  277. return
  278.  
  279. EJECT:
  280.  if EPactive=0 then
  281.  do
  282.   address 'DOPUS.1'
  283.   toptext 'EaglePlayer not loaded! Nothing to eject!'
  284.   exit
  285.  end
  286.  address 'rexx_EP'
  287.  call GETSTATUS
  288.  if name='RESULT' then
  289.  do
  290.   address 'DOPUS.1'
  291.   toptext 'No module loaded! Nothing to eject!'
  292.  end
  293.  else
  294.  do
  295.   Eject
  296.   address 'DOPUS.1'
  297.   toptext 'Module ejected! (Note: EP is still alive!)'
  298.  end
  299. return
  300.  
  301. QUIT:
  302.  if EPactive=0 then
  303.  do
  304.   address 'DOPUS.1'
  305.   toptext 'Why shall I quit EaglePlayer if it´s not yet loaded???'
  306.  end
  307.  else
  308.  do
  309.   address 'rexx_EP'
  310.   Quit
  311.   address 'DOPUS.1'
  312.   toptext 'EaglePlayer quitted!'
  313.  end
  314. return
  315.  
  316. EP2DOPUS:
  317.  if EPactive=0 then
  318.  do
  319.   address 'DOPUS.1'
  320.   toptext 'EaglePlayer not loaded! Can´t change public screen!'
  321.  end
  322.  else
  323.  do
  324.   address 'rexx_EP'
  325.   PubScreen DOPUS.1
  326.   address 'DOPUS.1'
  327.   toptext 'EaglePlayer opened on public screen DOPUS.1!'
  328.  end
  329. return
  330.  
  331. MODINFO1:
  332.  if EPactive=0 then
  333.  do
  334.   address 'DOPUS.1'
  335.   toptext 'EaglePlayer not loaded! Can´t get module infoz!'
  336.   exit
  337.  end
  338.  address 'rexx_EP'
  339.  call GETSTATUS
  340.  if name='RESULT' then
  341.  do
  342.   address 'DOPUS.1'
  343.   toptext 'No module loaded! Can´t get any infoz!'
  344.  end
  345.  else
  346.  do
  347.   address 'DOPUS.1'
  348.   uh='Playing "'
  349.   if pausedstate=1 then uh='UnPaused "'
  350.   if playing="no" then uh='Paused "'
  351.   toptext uh||songname||'" ('||player||') by '||author
  352.  end
  353. return
  354.  
  355. MODINFO2:
  356.  if EPactive=0 then
  357.  do
  358.   address 'DOPUS.1'
  359.   toptext 'EaglePlayer not loaded! Can´t get module infoz!'
  360.   exit
  361.  end
  362.  address 'rexx_EP'
  363.  call GETSTATUS
  364.  if name='RESULT' then
  365.  do
  366.   address 'DOPUS.1'
  367.   toptext 'No module loaded! Can´t get any infoz!'
  368.  end
  369.  else
  370.  do
  371.   address 'DOPUS.1'
  372.   toptext '"'||name||'"... Pos.'||posit||'/'||pattlen||' ('||songnumb||'/'||maxsubs||')  '||diffpat||' diff.pattz  '||samplez||' sampz'
  373.  end
  374. return
  375.  
  376. PLAYINFO:
  377.  if EPactive=0 then
  378.  do
  379.   address 'DOPUS.1'
  380.   toptext 'EaglePlayer not loaded! Can´t get player infoz!'
  381.   exit
  382.  end
  383.  address 'rexx_EP'
  384.  call GETSTATUS
  385.  if name='RESULT' then
  386.  do
  387.   address 'DOPUS.1'
  388.   toptext 'No module loaded! Can´t get any infoz!'
  389.  end
  390.  else
  391.  do
  392.   address 'DOPUS.1'
  393.   toptext player||' v'||version||' ('||date||')   Subsongs: '||subs||'  Replay: '||restart
  394.  end
  395. return
  396.  
  397. CHSUBSONG:
  398.  if EPactive=0 then
  399.  do
  400.   address 'DOPUS.1'
  401.   toptext 'EaglePlayer not loaded! Can´t change anything!'
  402.   exit
  403.  end
  404.  call GETSTATUS
  405.  if name='RESULT' then
  406.  do
  407.   address 'DOPUS.1'
  408.   toptext 'No module loaded! Sucker!'
  409.   exit
  410.  end
  411.  address 'rexx_EP'
  412.  if subs="no" then
  413.  do
  414.   address 'DOPUS.1'
  415.   toptext 'The '||player||' replayer doesn´t support subsongs!'
  416.   address 'rexx_EP'
  417.   if playing="yes" then
  418.   do
  419.    call delay 3
  420.    call MODINFO1
  421.   end
  422.   exit
  423.  end
  424.  if (songnumb=1) & (maxsubs=1) then
  425.  do
  426.   address 'DOPUS.1'
  427.   toptext 'Hey, this is the only song available!'
  428.   if playing="yes" then
  429.   do
  430.    call delay 3
  431.    call MODINFO2
  432.   end
  433.   exit
  434.  end
  435.  if (subsongchmode=1) & (songnumb=maxsubs) then
  436.  do
  437.   address 'DOPUS.1'
  438.   toptext 'This is the last subsong!'
  439.   if playing="yes" then
  440.   do
  441.    call delay 3
  442.    call MODINFO2
  443.   end
  444.   exit
  445.  end
  446.  if (subsongchmode=2) & (songnumb=1) then
  447.  do
  448.   address 'DOPUS.1'
  449.   toptext 'This is the first subsong!'
  450.   if playing="yes" then
  451.   do
  452.    call delay 3
  453.    call MODINFO2
  454.   end
  455.   exit
  456.  end
  457.  address 'DOPUS.1'
  458.  if subsongchmode=1 then
  459.  do
  460.   toptext 'Playing next subsong (nr.'||songnumb+1||')...'
  461.   address 'rexx_EP'
  462.   NextSong
  463.  end
  464.  else
  465.  do
  466.   toptext 'Playing previous subsong (nr.'||songnumb-1||')...'
  467.   address 'rexx_EP'
  468.   PrevSong
  469.  end
  470.  call delay 3
  471.  call MODINFO2
  472. return
  473.  
  474. GETSTATUS:
  475.  address 'rexx_EP'
  476.  
  477.  status g ply           /* Is the module playing? */
  478.  playing=result
  479.  
  480.  status g snd          /* Actual Songnumber */
  481.  songnumb=result
  482.  
  483.  status m fil           /* Filename of current module */
  484.  name=result
  485.  
  486.  status m son           /* Songname of current module */
  487.  songname=result
  488.  if songname='Unknown !' then songname=name
  489.  
  490.  status m aut           /* Name of composer */
  491.  author=result
  492.  if author='Unknown !' then author='<Unknown>'
  493.  
  494.  status m pnr           /* Number of current player (0 -> no module!) */
  495.  pnum=result
  496.  
  497.  status m pon           /* Actual position number */
  498.  posit=result
  499.  
  500.  status m len           /* Patternlength */
  501.  pattlen=result
  502.  if posit+pattlen>510 then
  503.  do
  504.   posit=N
  505.   pattlen=A
  506.  end
  507.  
  508.  status m max           /* Max. subsongs available */
  509.  maxsubs=result
  510.  
  511.  status m dpt           /* Number of different patterns */
  512.  diffpat=result
  513.  if diffpat>255 then diffpat='N/A'
  514.  
  515.  status m sam           /* Number of used samples */
  516.  samplez=result
  517.  if samplez>255 then samplez='N/A'
  518.  
  519.  'status p 'pnum' nam'  /* Name of current player */
  520.  player = result
  521.  
  522.  'status p 'pnum' ver'  /* Version number of current player */
  523.  version=result
  524.  
  525.  'status p 'pnum' dat'  /* Creation date of current player */
  526.  date=result
  527.  if date='Unknown !' then date='??.??.??'
  528.  
  529.  'status p 'pnum' sub'  /* Player supports subsongs? */
  530.  subs=result
  531.  
  532.  'status p 'pnum' rst'  /* Player supports Replay? */
  533.  restart=result
  534.  
  535.  /*** Here we get around some 'defects' of EaglePlayer (v1.52b) ***/
  536.  
  537.  /* Subsongnumbers are crap! */
  538.  if songnumb=0 then songnumb=1
  539.  maxsubs=maxsubs+1
  540.  
  541.  /* Name of TrackerPacker3 songs isn't detected correctly!!! */
  542.  if upper(songname)='TP3' then songname=name
  543. return
  544.