home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: WPS_PM / WPS_PM.zip / wall333r.zip / Exit1Chg.cmd < prev    next >
OS/2 REXX Batch file  |  1998-10-26  |  2KB  |  76 lines

  1. /*
  2.  *
  3.  * The Wall
  4.  * Exit1Chg.cmd - Set Enable/Disable Exit After 1st Change
  5.  *
  6.  * Rev.0 (13.Oct.98)
  7.  * > Start from here...
  8.  * Rev.1 (26.Oct.98)
  9.  * > Official Release
  10.  *
  11.  */
  12. say " "
  13. say "The Wall"
  14. say "Exit1Chg - Set Enable/Disable `Exit After 1st Change' Function"
  15.  
  16. parse arg . "/" option1
  17.  
  18. mode = "Disabled"
  19. if translate(option1) = "E" then mode = "Enabled"
  20. if translate(option1) = "D" then mode = "Enabled"
  21.  
  22. if mode = "Enabled" then do
  23.     ini_file = "Wall.ini"
  24.     ini_back = "Wall.$$$"
  25.  
  26.     /* Backup INI file */
  27.     say " "
  28.     say "- - - - - - - - - - - - - - - - - - - - - - - - - - "
  29.     "@copy "ini_file ini_back
  30.     say "- - - - - - - - - - - - - - - - - - - - - - - - - - "
  31.     say " "
  32.  
  33.     /* main */
  34.     cnt = 0
  35.     do until lines(ini_back) = 0
  36.         cnt = cnt + 1
  37.         text=strip(linein(ini_back))
  38.         parse var text keyword '=' .
  39.  
  40.         if keyword = "ExitAfter1stChange" then do
  41.             if translate(option1) = "E" then do
  42.                 say "Set Enabled"
  43.                 call lineout ini_file, "ExitAfter1stChange=Enabled"
  44.             end
  45.             else if translate(option1) = "D" then do
  46.                 say "Set Disabled"
  47.                 call lineout ini_file, "ExitAfter1stChange=Disabled"
  48.             end
  49.         end
  50.         else do
  51.             if cnt = 1 then do
  52.                 call lineout ini_file, text, 1
  53.             end
  54.             else do
  55.                 call lineout ini_file, text
  56.             end
  57.         end
  58.     end
  59.     call lineout ini_file
  60.     call lineout ini_back
  61.  
  62.     rc = SysFileDelete(ini_back)
  63.     say " "
  64.     say "Fin."
  65. end
  66. else if mode = "Disabled" then do
  67.    say " "
  68.    say "[Usage]"
  69.    say " "
  70.    say " C:\WALL>Exit1Chg /E - Enable `Exit After 1st Change' Function"
  71.    say " C:\WALL>Exit1Chg /D - Disable `Exit After 1st Change' Function"
  72.    say " "
  73. end
  74.  
  75. exit
  76.