home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / xwplascr.zip / XWPL0208.ZIP / release / install / freshini_lite.cmd < prev    next >
OS/2 REXX Batch file  |  2002-04-20  |  4KB  |  137 lines

  1. /*  freshini.cmd
  2.  
  3.     Registers the eWorkplace classes (and class replacements)
  4.     in the specified user INI file. The WPS will pick up the
  5.     changes after the next WPS startup with that INI file.
  6.  
  7.     (C) 2002 Ulrich Möller
  8.  */
  9.  
  10. call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
  11. call SysLoadFuncs
  12.  
  13. parse arg inifile
  14. if inifile == "" then do
  15.     Say "freshini.cmd (C) 2001-2002 Ulrich Möller"
  16.     Say "Sets up the INI file for a new eWorkplace installation."
  17.  
  18.     Say "Usage: freshini <inifile>";
  19.     Say "with <inifile> being the full path specification of an INI file."
  20.     Say "Specify USER to manipulate the OS2.INI which is currently in use.";
  21.     exit;
  22. end
  23.  
  24. /* get the directory from where we're started */
  25. parse source mydir;
  26. parse var mydir x1 x2 mydir;
  27.  
  28. say mydir
  29.  
  30. mydir = filespec("D", mydir)||filespec("P", mydir);
  31. if (right(mydir, 1) = "\") then
  32.     mydir = left(mydir, length(mydir)-1);
  33.  
  34. say mydir
  35.  
  36. /* mydir now has the install subdir of the xwp dir...
  37.         note that this works even if we are started from
  38.         a different directory;
  39.    replace "install" with "bin" to get the directory
  40.    of xfldr.dll */
  41.  
  42. p = pos("\INSTALL", translate(mydir));
  43. basedir = left(mydir, p - 1);
  44.  
  45. /* basedir now has the base dir without trailing \ */
  46.  
  47. bindir = basedir||"\bin";
  48.  
  49. xfldrdll = bindir||"\xfldr.dll";
  50.  
  51. rc = SysINI(inifile, "XWorkplace", "JustInstalled", "1");
  52. if (rc == 0) then do
  53.     Say "Error writing to "inifile". Terminating.";
  54.     exit;
  55. end
  56.  
  57. rc = SysINI(inifile, "XWorkplace", "XFolderPath", basedir || '00'x);
  58.  
  59. rc = RegisterClass("XWPFileSystem");        /* V0.9.16 */
  60. rc = RegisterClass("XFolder");
  61. rc = RegisterClass("XFldObject");
  62. rc = RegisterClass("XFldDataFile");
  63. rc = RegisterClass("XFldDisk");
  64. rc = RegisterClass("XFldDesktop");
  65. rc = RegisterClass("XWPProgramFile");       /* class renamed V0.9.16 */
  66. rc = RegisterClass("XWPSound");
  67. rc = RegisterClass("XWPString");
  68. rc = RegisterClass("XWPMouse");
  69. rc = RegisterClass("XWPKeyboard");
  70. rc = RegisterClass("XWPProgram");           /* V0.9.9 */
  71.  
  72. rc = ReplaceClass("WPFileSystem", "XWPFileSystem"); /* V0.9.16 */
  73. rc = ReplaceClass("WPFolder", "XFolder");
  74. rc = ReplaceClass("WPObject", "XFldObject");
  75. rc = ReplaceClass("WPDataFile", "XFldDataFile");
  76. rc = ReplaceClass("WPDisk", "XFldDisk");
  77. rc = ReplaceClass("WPDesktop", "XFldDesktop");
  78. rc = ReplaceClass("WPProgramFile", "XWPProgramFile"); /* class renamed V0.9.16 */
  79. rc = ReplaceClass("WPSound", "XWPSound");
  80. rc = ReplaceClass("WPMouse", "XWPMouse");
  81. rc = ReplaceClass("WPKeyboard", "XWPKeyboard");
  82. rc = ReplaceClass("WPProgram", "XWPProgram");       /* V0.9.9 */
  83.  
  84. /* rc = RegisterClass("XFldSystem"); */
  85. rc = RegisterClass("XFldWPS");
  86. rc = RegisterClass("XWPScreen");
  87. rc = RegisterClass("XFldStartup");
  88. rc = RegisterClass("XFldShutdown");
  89. /* rc = RegisterClass("XWPSetup"); */
  90. rc = RegisterClass("XWPTrashCan");
  91. rc = RegisterClass("XWPTrashObject");
  92. /* rc = RegisterClass("XWPClassList"); */
  93. /* rc = RegisterClass("XWPMedia"); */
  94. rc = RegisterClass("XCenter");
  95. rc = RegisterClass("XWPFontFolder");
  96. rc = RegisterClass("XWPFontFile");
  97. rc = RegisterClass("XWPFontObject");
  98.  
  99. exit;
  100.  
  101. /*
  102.  * RegisterClass:
  103.  *      little helper to register a class from xfldr.dll.
  104.  *
  105.  *      This adds a new key under "PM_InstallClass", with
  106.  *      the key name being the class name and the data the
  107.  *      DLL (which in this case is xfldr.dll, full-pathed above).
  108.  */
  109.  
  110. RegisterClass:
  111. parse arg classname
  112.  
  113. say "Registering "classname" in "xfldrdll;
  114.  
  115. rc = SysIni(inifile, "PM_InstallClass", classname, xfldrdll);
  116.  
  117. return rc;
  118.  
  119. /*
  120.  * ReplaceClass:
  121.  *      little helper to replace a class with another.
  122.  *
  123.  *      This adds a new key under "PM_InstallClassReplacement",
  124.  *      with the key name being the replacee and the data the
  125.  *      replacement class.
  126.  */
  127.  
  128. ReplaceClass:
  129. parse arg oldclass, newclass
  130.  
  131. say "Replacing "oldclass" with "newclass;
  132.  
  133. rc = SysIni(inifile, "PM_InstallClassReplacement", oldclass, newclass);
  134.  
  135. return rc;
  136.  
  137.