home *** CD-ROM | disk | FTP | other *** search
/ Amiga MA Magazine 1998 #6 / amigamamagazinepolishissue1998.iso / coders / arexx / ep_pack / ep_techlist.rexx < prev   
OS/2 REXX Batch file  |  1996-10-13  |  4KB  |  200 lines

  1. /* 
  2.              Technolister By Warp of GiGA Productions...©1996
  3.  
  4.     Designed for 'Eagleplayer v1.54c Generic' (Should work on older vers!·)        
  5.  
  6.    Use this to generate a list, of your best techno-modz!?
  7.    Assign a Hotkey to this script, using option=ADD, then whenever
  8.    you hear a cool module, you press the hotkey...KEWL!
  9.  
  10.    Then it's Friday, and you want to hear only your coolest modz!,
  11.    but you can't seem to remember a single filename...Hmmm!
  12.  
  13.    YUP! You run Technolister with the 'USE' option (via Hotkey!),
  14.    This proggy then scans your modlist, and plays one of them...(Random!) 
  15.                                                             ß·) - simple huh? 
  16.  
  17.    BTW: The datafile is stored in 'S:Techno.dat' as plain ASCII...
  18.  
  19.  
  20.                                  History:
  21.                                  
  22.            V1.1 - 13 Oct 1996 - When in USE mode: 
  23.             Cleans up the list, so it only stores one of each mod.
  24.             The Writing process is done after the mod. Has been loaded. 
  25.             When using CLR mode, backups are made (S:Techno.BAK - Hey Source!)
  26.         V1.0 - 17 May 1996 - Initial release.
  27. */
  28.  
  29.  
  30. Xver='V1.1'
  31.  
  32. Parse upper arg OPT 
  33.  
  34.  
  35. Waittime=5
  36. Testflag=0
  37. Time ('R')
  38.  
  39. Options results
  40.  
  41.  
  42. do while (Testflag=0) & (Time('E') < Waittime)
  43.     if (pos('rexx_EP',SHOW('Ports')) ~= 0) then testflag =1
  44. end
  45. if testflag=0 then do 
  46.     say 'Eageplayer could not be reached...Try starting it...'
  47.      exit(0)
  48. end
  49.  
  50. Address 'rexx_EP'
  51.  
  52. EXI = exists('S:Techno.dat')
  53.  
  54. if  EXI ~= 1 | OPT='CLR' then do 
  55.  
  56.     IF EXI = 1 then address command "C:Copy S:Techno.dat S:Techno.BAK"
  57.     Success = Open(ModFile,'S:Techno.dat',Write)
  58.     if Success = 0 then do
  59.         Say 'IO-Error!!!! - quitting...'
  60.         exit(0)
  61.     end
  62.     call Close(Modfile)
  63. end
  64.  
  65. if OPT='CLR' then do
  66.     Scrolltext 'Modlist is cleared...Backup: S:Techno.BAK'
  67.     Exit(0)
  68. end
  69.  
  70. Select
  71.     when opt = 'ADD' then do
  72.         status m fil
  73.         Modname = result
  74.  
  75.         Success = Open(ModFile,'S:Techno.dat',Append)
  76.         if Success = 0 then do
  77.                    Say 'IO-Error!!! - quitting...'
  78.                 exit
  79.            end
  80.  
  81.         Call WriteLN(ModFile,Modname)
  82.         Call Close(ModFile)
  83.         Scrolltext Modname' has been added...\X/'
  84.  
  85.     end /* END ADD */
  86.  
  87.     when opt = 'USE' then do
  88.         if exists('S:Techno.dat') = 1 then do 
  89.  
  90.             Success = Open(ModFile,'S:Techno.dat',Read)
  91.             if Success = 0 then do
  92.                    Scrolltext 'IO-Error!!! - quitting...'
  93.                 exit
  94.                end
  95.     
  96.             mod.=''
  97.             modcoun=0
  98.     
  99.             Do while EOF(ModFile) ~= 1 
  100.                 modcoun = modcoun + 1
  101.                 mod.modcoun = ReadLN(Modfile)
  102.             end
  103.             Call Close(ModFile)
  104.             
  105.               modcoun=modcoun-1
  106.  
  107.             mods.=''
  108.             modscoun=0
  109.  
  110.             do i = 1 to modcoun
  111.                 if LookUp(mod.i) = 0 then do
  112.                     modscoun = modscoun + 1        
  113.                     mods.modscoun = mod.i        
  114.                 end
  115.             end
  116.  
  117.             if modscoun<2 then do
  118.                 Scrolltext 'Modlist is empty, add some first...(Min. 2 Max .?)'
  119.                 exit
  120.             end
  121.  
  122.  
  123.             status m fil
  124.                 Modname = result
  125.  
  126.             status m dir
  127.             modpath = result
  128.  
  129.             seed = time(s)
  130.             ran = random(1,modscoun,seed) 
  131.  
  132.             do while mods.ran = modname
  133.                 seed = time(s)
  134.                 ran = random(1,modscoun,seed) 
  135.             end
  136.  
  137.             pmod='"'||modpath||'" '
  138.  
  139.             pmod=pmod||'"'||mods.ran||'" '
  140.  
  141.             do i=1 to modscoun 
  142.                 if i~=ran then do
  143.                     pmod=pmod||'"'||mods.i||'" '
  144.                 end
  145.             end
  146.  
  147.  
  148.             Loadmodule pmod
  149.  
  150.  
  151.             Success = Open(ModFile,'S:Techno.dat','W')
  152.             if Success = 0 then do
  153.                    Scrolltext 'IO-Error!!! - quitting...'
  154.                 exit
  155.                end
  156.  
  157.             Do i = 1 to modscoun
  158.                 Call WriteLN(ModFile,Mods.i)
  159.             end
  160.  
  161.             Call Close(ModFile)
  162.             
  163.         end
  164.     end /* END USE */
  165.  
  166.     otherwise do
  167.  
  168.         Say '' ; Say Center(".·Welcome to Technolister "XVER" By Warp oh' GiGA Prod. ©1996·.",80)
  169.         say '' ; say ' Designed only for use with Eagleplayer V1.52+'
  170.         say ''
  171.         say '  Usage:'
  172.         say '        Rx S:EP_Techlist.rexx  [Add | Use | Clr]'
  173.         say '' ; say ''
  174.         say '  Please see the top of the Source for more detailed explantion of the prog...ß·)'
  175.  
  176.     end /* END HELP */
  177.  
  178. end /* END Select */
  179.  
  180.     
  181. exit(0)
  182.  
  183.  
  184.  
  185. /* Funcs() - Begin */
  186.  
  187.  
  188. Lookup: Procedure Expose mods. modscoun
  189.     Parse arg mod
  190.  
  191.     Do M = 1 to modscoun+1
  192.         If mod = mods.M then return M
  193.     End
  194.  
  195. Return 0
  196. /*  Lookup() checks if a mod. is already in the list, and returns it's position 
  197.     If it can't find it, it returns 0
  198. */
  199.     
  200.