GGuezet
7 years agoContributor
Method RemoveOption don't work ?
Hi, I'm trying to use the method RemoveOption (and removeOptionByIndex) on one of my ini files, but it didn't seem to work This is what my code (VBS) looks like: function clear_watchdog
...
- 7 years ago
I'm not sure... but I think it might have to do with you referencing the INI file as "Storages.INI(INI_PATH)" throughout the code rather than assigning the particular object. I'm not a VBSCript guy but what happens if your change your code like so:
function clear_watchdog INI_PATH = C:\xxx\xxx\variables.ini INIFile = Storages.INI(INI_PATH) for i = 0 to INIFile.GetSubSection("VARIABLES").OptionCount-1 OptionName = INIFile.GetSubSection("VARIABLES").GetOptionName(i) if InStr(OptionName,"MEM_USAGE_STARTUP") <> 0 then INIFile.GetSubSection("VARIABLES").RemoveOption(OptionName) end if next INIFile.Save End Function