home *** CD-ROM | disk | FTP | other *** search
/ Dr. CD ROM (Annual Premium Edition) / premium.zip / premium / WINUTIL2 / WB_41E.ZIP / INIEDIT.WB_ < prev    next >
Text File  |  1992-04-28  |  3KB  |  97 lines

  1. CR=strcat(Num2char(13),Num2char(10))
  2. TAB=Num2Char(9)
  3. DirChange(DirWindows(0))
  4. canned="BYEBYE"
  5. IniFiles=""
  6. bSys386=0
  7.  
  8. :UP1
  9. canned="byebye"
  10. If IniFiles!="" then goto inied
  11. IniFiles=FileItemize("*.INI")
  12. :inied
  13. TheFile=ItemSelect("Choose Desired INI file",IniFiles," ")
  14. if TheFile=="" then goto newini
  15. Sections=""
  16.  
  17. :UP2
  18. canned="up1"
  19. if Sections!="" then goto sected
  20. Sections=IniItemizePvt("",TheFile)
  21. :SECTED
  22. Section=ItemSelect("%TheFile% - Choose Section",Sections,TAB)
  23. if Section=="" then goto AddSect
  24. if stricmp(Section,"386Enh")==0 then bSys386=1
  25.                                 else bSys386=0
  26. KeyValues=""
  27.  
  28. :UP3
  29. canned="up2"
  30. if KeyValues!="" then goto looped
  31. Keys=IniItemizePvt(Section,TheFile)
  32. if (bSys386) then Keys=StrReplace(Keys,"device%TAB%","")
  33.              then Keys=StrReplace(Keys,"Device%TAB%","")
  34.              then Keys=StrReplace(Keys,"DEVICE%TAB%","")
  35.              then Keys=StrReplace(Keys,"device","")
  36.              then Keys=StrReplace(Keys,"Device","")
  37.              then Keys=StrReplace(Keys,"DEVICE","")
  38.              
  39. KeyMax=ItemCount(Keys,TAB)
  40. KeyIndex=0
  41.  
  42. :Loop
  43. if KeyIndex==KeyMax then goto looped
  44. KeyIndex=KeyIndex+1
  45. ThisKey=ItemExtract(KeyIndex,Keys,TAB)
  46. ThisValue=IniReadPvt(Section,ThisKey,"???",TheFile)
  47. KeyValues=strcat(KeyValues,ThisKey,"= ",ThisValue,TAB)
  48. goto Loop
  49.  
  50. :looped
  51. Key=ItemSelect("%TheFile% [%Section%] - Choose Keyword",KeyValues,TAB)
  52. if Key=="" then goto AddKey
  53. Key=ItemExtract(1,Key,"=")
  54.  
  55. Value=IniReadPvt(Section,Key,"???",TheFile)
  56. goto entkey
  57.  
  58.  
  59. :newini
  60. canned="UP1"
  61. TheFile=Askline("Making NEW INI file","Enter new INI file name","*.INI")
  62. if (TheFile=="*.INI" || TheFile=="") then goto newini
  63. IniFIles=""
  64. goto AddSectNewIni
  65.  
  66. :AddSect
  67. canned="up2"
  68. :AddSectNewIni
  69. Section=AskLine("Add New Section to INI File","Enter new section name for%CR%   %TheFile%%CR%      [?????]","")
  70. Sections=""
  71. goto AddKeyNewSect
  72.  
  73. :AddKey
  74. canned="up3"
  75. :AddKeyNewSect
  76. Key=AskLine("Add New Keyword to INI File","Enter new key name for%CR%   %TheFile%%CR%      [%Section%]","")
  77. if (bSys386 && stricmp(Key,"device"==0)) then Message("Error","Cannot modify or add DEVICE= lines to [386Enh]%CR%with this WBT File")
  78.                                          then goto AddKeyNewSect
  79. Value="(Undefined)"
  80. KeyValues=""
  81. goto EntKeyNewKey
  82.  
  83. :ENTKEY
  84. canned="up3"
  85. :EntKeyNewkey
  86. NewValue=AskLine("Modify INI File Keyword","%TheFile%%CR%   [%Section%]%CR%      %Key% = %Value%",Value)
  87. if NewValue!=Value then iniwritepvt(Section,Key,NewValue,TheFile)
  88. KeyValues=""
  89. goto up3
  90.  
  91.  
  92. :CANCEL
  93. goto %Canned%
  94.  
  95. :BYEBYE
  96. exit
  97.