Rob van der Woude's Scripting Pages
Powered by GeSHi

Source code for cdlist.cmd

(view source code of cdlist.cmd as plain text)

  1. /*
  2.  浜様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様
  3.   CDlist:  Creates a list of all CDs in CDP.INI and writes it to CDPTXT.INI 
  4.   Written by Rob van der Woude                                              
  5.   Latest revision:   1999/08/02                                             
  6.   Use this program together with CDadd.cmd to save (and edit if you like)   
  7.   the list of CD titles and songs from MMOS2's CDP.INI in ASCII format.     
  8.   Please feel free to use, distribute and modify this program.              
  9.   However, do so entirely at your own risk.                                 
  10.   The author cannot be held responsible for any damage or loss of data,     
  11.   caused by the use or inability to use this program.                       
  12.   If you modify this program, please document the modifications.            
  13.   I would also like to receive an e-mail message stating the nature of the  
  14.   modifications.                                                            
  15.  藩様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様様
  16. */
  17.  
  18. /* Initialize RexxUtil */
  19. call RxFuncAdd "SysLoadFuncs", "RexxUtil", "SysLoadFuncs"
  20. call SysLoadFuncs
  21.  
  22. /* Find full path to MMOS2's CD Player's INI files */
  23. mmbase = strip( value( "MMBASE", , "OS2ENVIRONMENT" ), "T", ";" )
  24. cdpini = mmbase||"\CDP.INI"
  25. cdptxt = mmbase||"\CDPTXT.INI"
  26. cdpbak = mmbase||"\CDPTXT.BAK"
  27.  
  28. /* Check if CDP.INI exists */
  29. call SysFileTree cdpini, "found.", "F"
  30. if found.0 <> 1 then do
  31. 	call SysCls
  32. 	say ""
  33. 	call beep 880, 250
  34. 	say " CDP.INI not found!"
  35. 	say ""
  36. 	exit
  37. end
  38.  
  39. /* Check if ASCII version alreasy exists; if so, either delete or rename it */
  40. call SysFileTree cdptxt, "exist.", "F", , "**---"
  41. freq = 220
  42. if exist.0 = 1 then do forever
  43. 	call beep freq, 250
  44. 	say ""
  45. 	say " File "||cdptxt||" already exists; do you want to rename it and create"
  46. 	say " a new file or do you want to delete the old file? [rd]"
  47. 	call SysCurState "OFF"
  48. 	answer = translate( SysGetKey( "NOECHO" ) )
  49. 	call SysFileTree cdpbak, "exist.", "F", , "**---"
  50. 	if answer = "R" then do
  51. 		if exist.0 = 1 then address CMD "@CMD /C DEL "||cdpbak
  52. 		address CMD "@CMD /C REN "||cdptxt||" *.BAK"
  53. 		leave
  54. 	end
  55. 	if answer = "D" then do
  56. 		address CMD "@CMD /C DEL "||cdptxt
  57. 		leave
  58. 	end
  59. 	freq = freq * 2
  60. 	if freq > 3000 then freq = 220
  61. end
  62.  
  63. /* Write header */
  64. call SysCls
  65. string = "Text version of CDP.INI"
  66. say string
  67. call lineout cdptxt, ";"||string
  68. string = date()||" "||time()
  69. say string
  70. call lineout cdptxt, ";"||string
  71. call lineout cdptxt, ""
  72.  
  73. /* Lijst met CD's */
  74. call SysIni cdpini, "ALL:", "cd."
  75. if cdlist.0 > 0 then do i=1 to cd.0 by 1
  76. 	call SysIni cdpini, cd.i, "ALL:", cd.i.
  77. 	if cd.i.0 > 0 then do j=1 to cd.i.0 by 1
  78. 		if cd.i.j = "IMMCDDiscTitle" then do
  79. 			string = "["||translate( SysIni( cdpini, cd.i, cd.i.j ), "()", "[]" )||"]"
  80. 			say ""||string||""
  81. 			call lineout cdptxt, string
  82. 			string = "  Checksum = "||cd.i
  83. 			say ""||string||""
  84. 			call lineout cdptxt, string
  85. 			string = "  IMMCDDiscTitle = "||SysIni( cdpini, cd.i, cd.i.j )
  86. 			say ""||string||""
  87. 			call lineout cdptxt, string
  88. 		end
  89. 	end
  90. 	if cd.i.0 > 0 then do j=1 to cd.i.0 by 1
  91. 		if abbrev( cd.i.j, "IMMCDDisc" ) = 0 then do
  92. 			string = "  "||cd.i.j||" = "||translate( SysIni( cdpini, cd.i, cd.i.j ), "; ", "0D0A"X )
  93. 			say ""||string||""
  94. 			call lineout cdptxt, string
  95. 		end
  96. 		else do
  97. 			if cd.i.j <> "IMMCDDiscTitle" then do
  98. 				string = '  '||cd.i.j||' = "'||c2x( SysIni( cdpini, cd.i, cd.i.j ) )||'"X'
  99. 				say ""||string||""
  100. 				call lineout cdptxt, string
  101. 			end
  102. 		end
  103. 	end
  104. 	call lineout cdptxt, ""
  105. end
  106. call lineout cdptxt
  107.  

page last uploaded: 2017-04-06, 13:33