INITool Object allows an ASP programmer to work with INI files on the server.
You must call the Load() method before calling any other methods of the class.
Usage:
> object.Save()
saves any changes made to the INI file after the last call to the Load() method. Overwrites an existing INI file or creates a new INI file if the file doesn't exist.
> object.Clear()
purges the internal hash table of header/key/value combinations. If the Save() method is called, this will clear the ini file and replace it with 0 bytes of data (will not delete the file). The internal hash table contains no valid data after the Clear() method is called. You must call Load() to repopulate the hashtable after calling Clear() if you wish to continue working with INI files...
> object.Remove(header, key)
removes a key/value combination from a specified header in the internal hash table. If save() is called, this key/value combination will be removed from the specified header in the INI file.
> object.Write(header, key, value)
creates a new header/key/value combination or updates the value of an already existing header/key/value combination. If the header doesn't already exist, it is added to the internal hash table along with an attached key and value. If the header already exists but the key doesn't, the key is created under the already existing header. If the header/key combination already exists and has a value, the value is reset with the newly entered value. Changes to the actual INI file do not take effect until you call the Save() method.
> variant = object.Read(header, key, defaultvalue)
reads the value of a specified key in the specified header. If the header or key doesn't exist, defaultvalue is returned. Otherwise the value of key is returned.
> object.DumpHashTable()
remnants of debugging. prints the contents of the internal hashtable at that particular moment. all existing and newly created header/key/value pairs are stored in this hash table after the load() method is called. Calling the Read(), Write(), Remove() and Clear() methods affects the internal hash table only and not the actual INI file. The actual INI file is not over-written until the save() method is called. The internal hash table is cleared only when either the clear() or load() methods are called or when the INITool class is created or set to nothing.
> object.Load(absolutepath)
loads an INI file's header/key/value combinations into an internal hash table so the data can be more easily worked with by the class. If the INI file specified in absolutepath doesn't exist, the internal hash table representing the INI file's contents will be empty. You can add to the loaded INI file with the Write() method. You commit to changes or create a new INI file by calling the Save() method. Load() must be called before any other methods of the class.
> array = object.Headers()
returns an array containing all header names in the INI file specified in the Load() argument. Use the VBScript inherent function IsArray to test the return value to see if it contains any valid data.
> array = object.Keys(header)
returns an array containing all key names under the header specified in the header argument in the INI file specified in the Load Argument. Use the VBScript inherent function IsArray to test the return value to see if it contains any valid data.
Access is limited.
Login here using your Linkedin account. to see or download code.
No registration, not another password to remember, login using your Linkedin account and have access to all public codes in Boldcodes.com
Linkedin LoginOr
header, key, defaultvalue
OR
header, key, newvalue
Or
header, key
Or
header
Or
Views 3,760
Downloads 1,517
ANmarAmdeen
701