I have been toying with the below script to be able to read settings for use with my HTA (creating a game launcher).
Here is my current HTA:
It doesn't quite work, it complains of the WScript
object being required. While I understand Echo
will not work like that in a HTA I am having trouble modifying the code so it will work. Even just removing all Echo
references it still has an issue with objOrgIni
on line 200 of the below code (with the WScript
references removed):
I don't even need that level of error checking as the INI will exist etc, I just need a simple way to read from and write to an INI in my scripting. Any help you guys can give me in achieving that would be great, it's a little advanced for me just yet, but I'd love an explanation as to why it fails.
There is no easy way to use INI files with VBScript. You'd have to write the functionality yourself or find some existing code that does it.
But do you really need an INI specifically or just a way to save settings? You could just keep all of your settings in a
Dictionary
object and serialize it as needed.For example, here are two functions --
LoadSettings
andSaveSettings
-- that do just that.Imagine you had the following settings file saved at
c:\settings.txt
:You'd use the functions above like this: