home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 3 / AACD03.BIN / AACD / CDROM / ReadCDTitles / ReadTitles.rexx < prev    next >
OS/2 REXX Batch file  |  1997-01-01  |  2KB  |  88 lines

  1. /* ReadTitles.rexx v1.1 © 1996-97 Roy E Brown <roy@ebrown.demon.co.uk> */
  2.  
  3. /* $Ver: ReadTitles.rexx V1.1 (1.1.97) */
  4.  
  5. /* One thing that has always annoyed me about song catalogs for the various CD
  6.    players is that you cannot identify the CD's just by looking at the
  7.    filenames - ID10300A32042737 is totally meaningless. :(
  8.  
  9.    This script can read song files (with filenames like ID10300A32042737 etc),
  10.    get the artist and title of the CD and write them both as a filenote to the
  11.    file. This makes it easier to identify a particular CD song file - especially
  12.    using DOpus 5 or similar.
  13.  
  14.    New for V1.1 - you can now write the output to a separate index file.
  15. */
  16.  
  17. /* Set this the first characters of the filename that are common to all
  18.    filenames - need only be the first one or two. Leave the '#?' in place. */
  19.  
  20. FileStart="ID#?"
  21.  
  22. /****** No need to touch anything below this line ******/
  23.  
  24. Options FailAt 21
  25.  
  26. n=0
  27. lf='0a'x
  28.  
  29. If ~Show('L',"rexxreqtools.library") Then
  30.    AddLib('rexxreqtools.library',0,-30,0)
  31.  
  32. DiskDir=RTFILEREQUEST(,,'Select your Disks directory..',,'rtfi_flags=freqf_nofiles')
  33. If rtresult=0|DiskDir='' Then Exit
  34.  
  35. If ~Exists(DiskDir) Then
  36.   Do
  37.      Say "Directory not found"
  38.      Exit
  39.   End
  40.  
  41. a=Pragma("D",DiskDir)
  42.  
  43. Call RTEZREQUEST(" Write output as a file comment "lf,
  44.                  "     or to an index file?",,
  45.                  "Comment|File|Cancel","ReadCDTitles V1.1 ©1996-97 R E Brown",,
  46.                  "rt_reqpos=reqpos_centerscr","Dest")
  47. If Dest=0 Then Exit
  48.  
  49. Address Command 'List 'FileStart' LFormat %N > T:DiskList'
  50.  
  51. Address
  52. Call Open(list,"T:DiskList")
  53. Do While EOF(list)=0
  54.    n=n+1
  55.    File.n=Readln(list)
  56. End
  57.  
  58. Do x=1 to n-1
  59.    Call Open(name,File.x)
  60.    CD.Artist=Readln(name)
  61.    CD.Title=Readln(name)
  62.    Comment=CD.Artist||' - '||CD.Title
  63.    If Dest=1 Then
  64.       Address Command 'Filenote 'File.x' "'Comment'"'
  65.    Else
  66.       Do         
  67.         Call open(index,DiskDir||'RCDIndex',w)
  68.         Call WriteLn(index,Comment)
  69.  
  70.       End
  71.    call Close(name)
  72. End
  73.  
  74. If Dest=2 Then
  75.   Done=" The index has been witten as  "lf||DiskDir||"RCDIndex"
  76. Else
  77.   Done="The CD Titles and Artists have "lf"been written as file comments"
  78.  
  79.   Call RTEZREQUEST(Done,"Thank You","ReadCDTitles V1.1 ©1996-97 R E Brown",,
  80.                    "rt_reqpos=reqpos_centerscr")
  81.  
  82. a=Close(list)
  83.  
  84. Address Command 'Delete >NIL: T:DiskList'
  85.  
  86. Exit
  87.  
  88.