home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 35 Internet / 35-Internet.zip / lpr32.zip / lpr32.cmd < prev    next >
OS/2 REXX Batch file  |  2001-05-28  |  3KB  |  104 lines

  1. /* ------------------------------------------------------------------ */
  2. /* lpr32.cmd                                                          */
  3. /*                                                                    */
  4. /* REXX script to recreate INI data for OS2SYS.INI                    */
  5. /*                                                                    */
  6. /* Created on 28 May 2001 at 23:45:33 by mINI v1.05                  */
  7. /* Code based on Bernd Schemmer's ConvINI                             */
  8. /* ------------------------------------------------------------------ */
  9.  
  10.  
  11. /* --------------- Name of INI file to recreate or update ----------- */
  12. curIniFile = "D:\OS2\OS2SYS.INI"
  13.  
  14. /* --------------- Load necessary REXXUTIL function(s) -------------- */
  15. call rxFuncAdd "SysIni", "REXXUTIL", "SysIni"
  16.  
  17. /* ------------------------------------------------------------------ */
  18.  
  19.  
  20. /* --------------- Init stem with data ------------------------------ */
  21. iniFileApps.0 = 0 
  22. i = iniFileApps.0 
  23.  
  24. /* ------------------------------------------------------------------ */
  25. /*  Application: PM_LPR1 */
  26.  
  27. i=i+1
  28. IniFileApps.i.__Application = "PM_LPR1"
  29. IniFileApps.i.__Keys.0 = 0 
  30.  
  31. j = IniFileApps.i.__Keys.0 
  32.  
  33. j = j+1 
  34. IniFileApps.i.__Keys.j.__Key = "DESCRIPTION"
  35. IniFileApps.i.__Keys.j.__Val = "LPR1" || "00"x 
  36. j = j+1 
  37. IniFileApps.i.__Keys.j.__Key = "INITIALIZATION"
  38. IniFileApps.i.__Keys.j.__Val = "127.0.0.1#PRINT#D:\SPOOL;" || "00"x 
  39. j = j+1 
  40. IniFileApps.i.__Keys.j.__Key = "TERMINATION"
  41. IniFileApps.i.__Keys.j.__Val = ";" || "00"x 
  42. j = j+1 
  43. IniFileApps.i.__Keys.j.__Key = "PORTDRIVER"
  44. IniFileApps.i.__Keys.j.__Val = "LPR32;" || "00"x 
  45. j = j+1 
  46. IniFileApps.i.__Keys.j.__Key = "TIMEOUT"
  47. IniFileApps.i.__Keys.j.__Val = "45;" || "00"x 
  48. IniFileApps.i.__Keys.0 = j 
  49.  
  50. /* ------------------------------------------------------------------ */
  51.  
  52. iniFileApps.0 = i 
  53.  
  54. /* ------------------------------------------------------------------ */
  55. say "" 
  56. say "Recreating or updating... " 
  57. say "..." || curIniFile || " (" || IniFileApps.0 || " application(s))" 
  58. say "" 
  59. say "Press any key to continue or CTRL-C to abort ..." 
  60. "@PAUSE >NUL" 
  61.  
  62. do i = 1 to IniFileApps.0 
  63.  
  64.   curApplication = IniFileApps.i.__Application 
  65.  
  66.   say " Writing keys for application """ || , 
  67.       ConvertString( curApplication ) || , 
  68.       """ (" || i || " of " || IniFileApps.0 || ")" 
  69.  
  70.   do j = 1 to IniFileApps.i.__Keys.0 
  71.     curKey = IniFileApps.i.__Keys.j.__Key 
  72.     curVal = IniFileApps.i.__Keys.j.__Val 
  73.  
  74.     say "    Writing key """ || , 
  75.         convertString( curKey ) || , 
  76.         """ (" || j || " of " || , 
  77.         IniFileApps.i.__Keys.0 || ")" 
  78.  
  79.     thisRC = SysIni( curIniFile,, 
  80.                      curApplication,, 
  81.                      curKey,, 
  82.                      curVal ) 
  83.     if thisRC = "ERROR:" then 
  84.       say "Warning: Error writing key <" || , 
  85.           ConvertString( curKey ) || ">!" 
  86.   end 
  87.  
  88. end 
  89.  
  90. exit 
  91.  
  92. /* ------------------------------------------------------------------ */
  93.  
  94. ConvertString: PROCEDURE 
  95.   parse arg sourceString 
  96.   return translate( sourceString,, 
  97.          "????????????????????????????????" ,, 
  98.          "000102030405060708090A0B0C0D0E0F"x || , 
  99.          "101112131415161718191A1B1C1D1E1F"x ) 
  100.  
  101. /* ------------------------------------------------------------------ */
  102.  
  103.  
  104.