home *** CD-ROM | disk | FTP | other *** search
/ The Pier Shareware 6 / The_Pier_Shareware_Number_6_(The_Pier_Exchange)_(1995).iso / 035 / fm2_214.zip / MIGINI.CMD < prev    next >
OS/2 REXX Batch file  |  1994-08-16  |  4KB  |  113 lines

  1. /*
  2.  * FM/2 2.x associations/commands migration utility
  3.  * copyright (c) 1994 by M. Kimes
  4.  *
  5.  * This program copies Commands, Associations and Registration from an
  6.  * FM/2 1.x INI file into an FM/2 2.x INI file.  It should only be run
  7.  * once (and INSTALL.CMD should run it for you).
  8.  *
  9.  * For unattended use, remove the lines marked with "NOTE:" below.
  10.  */
  11.  
  12. /* skip clear screen if called with an argument (from INSTALL.CMD) */
  13. '@Echo off'
  14. arg dummy
  15. if dummy = '' then 'cls'
  16.  
  17. /* load utility functions */
  18. call RxFuncAdd 'SysLoadFuncs', 'RexxUtil', 'SysLoadFuncs'
  19. call SysLoadFuncs
  20.  
  21. /* find FM2.INI file */
  22.  
  23. fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  24. if fm2ini \= '' then fm2ini = stream(fm2ini,'c','query exists')
  25. if fm2ini = '' then
  26. do
  27.   fm2ini = value('fm2ini',,'OS2ENVIRONMENT')
  28.   if fm2ini \= '' then
  29.   do
  30.     fm2ini = insert('\FM2.INI',fm2ini,length(fm2ini))
  31.     fm2ini = stream(fm2ini,'c','query exists')
  32.   end
  33. end
  34. if fm2ini = '' then fm2ini = SysSearchPath('PATH', 'FM2.INI')
  35. if fm2ini = '' then fm2ini = SysSearchPath('DPATH', 'FM2.INI')
  36. if fm2ini = '' then fm2ini = SysSearchPath('XPATH', 'FM2.INI')
  37. if fm2ini = '' then
  38. do
  39.   say 'Sorry, FM2.INI not found.  Might not be right directory.'
  40.   say 'Place FM2.INI in the FM/2 2.x directory and try again.'
  41.   say 'Terminating.'
  42.   exit
  43. end
  44.  
  45. /* skip program intro if called with argument (from INSTALL.CMD) */
  46. arg dummy
  47. if dummy = '' then
  48. do
  49.   /* check for existing fm3.ini file so we can warn user */
  50.   rc = stream('fm3.ini','c','query exists')
  51.   say ''
  52.   say 'This program migrates Associations, Commands and Registration from'
  53.   say 'FM/2 1.x INI file ('fm2ini') to FM/2 2.x INI file.'
  54.   if rc \= '' then
  55.   do
  56.     say ''
  57.     say ' **WARNING: Information in existing 'rc' will be overwritten.'
  58.   end
  59.   say ''
  60.  
  61.   /* NOTE: remove 3 following lines for unattended use... */
  62.   say 'Press [Enter].'
  63.   pull dummy .
  64.   say ''
  65.  
  66. end
  67.  
  68. say 'Migrating Associations, Commands and Registration from FM/2 1.x...'
  69.  
  70. /* get INI info from fm2.ini */
  71. assoc = SysIni(fm2ini, 'FM2', 'Associations')
  72. commands = SysIni(fm2ini, 'FM2', 'Commands')
  73. register = SysIni(fm2ini, 'FM2', 'Registration')
  74. editor = SysIni(fm2ini,'FM2','Editor')
  75. viewer = SysIni(fm2ini,'FM2','Viewer')
  76. compare = SysIni(fm2ini,'FM2','Compare')
  77. extractpath = SysIni(fm2ini,'FM2','ExtractPath')
  78. printer = SysIni(fm2ini,'FM2','Printer')
  79. virus = SysIni(fm2ini,'FM2','Virus')
  80.  
  81. /* write INI info to fm3.ini */
  82. if assoc \= '' then
  83.   if assoc \= 'ERROR:' then
  84.     call SysIni 'FM3.INI', 'FM/3', 'Associations', assoc
  85. if commands \= '' then
  86.   if commands \= 'ERROR:' then
  87.     call SysIni 'FM3.INI', 'FM/3', 'Commands', commands
  88. if register \= '' then
  89.   if register \= 'ERROR:' then
  90.     call SysIni 'FM3.INI', 'FM/3', 'Registration', register
  91. if editor \= '' then
  92.   if editor \= 'ERROR:' then
  93.     call SysIni 'FM3.INI','FM/3','Editor',editor
  94. if viewer \= '' then
  95.   if viewer \= 'ERROR:' then
  96.     call SysIni 'FM3.INI','FM/3','Viewer',viewer
  97. if compare \= '' then
  98.   if compare \= 'ERROR:' then
  99.     call SysIni 'FM3.INI','FM/3','Compare',compare
  100. if extractpath \= '' then
  101.   if extractpath \= 'ERROR:' then
  102.     call SysIni 'FM3.INI','FM/3','ExtractPath',extractpath
  103. if printer \= '' then
  104.   if printer \= 'ERROR:' then
  105.     call SysIni 'FM3.INI','FM/3','Printer',printer
  106. if virus \= '' then
  107.   if virus \= 'ERROR:' then
  108.     call SysIni 'FM3.INI','FM/3','Virus',virus
  109.  
  110. /* tell user we're done, if no args (not called from INSTALL.CMD) */
  111. arg dummy
  112. if dummy = '' then say 'Complete.'
  113.