WSHWIControl.OCX

Installation

Use the RegisterOcx.bat to register the new OCX File on your Computer

DeInstallation

Use the UnRegisterOcx.baf to deinstall the OCX File

How to work with the OCX

Declaration of an Object

Create a new object and allocate memory, use the DIM command and initialized with the SET command

Dim ObjAdr

Set ObjAdr =? WScript.CreateObject("WSHWIControl.WSHExt")

Deallocate the memory of an Object

Set ObjAdr = Nothing

The Commands of the OCX File

Read a key for a INI File

Syntax:???????????? Object.WSHGetINI("SectionName","KeyName"," TheINIFile")

Example:????????? Answer = objadr.WSHGetINI("Test","Name5","c:\temp\test.ini")
After execute the WSHGetINI the value is stored in the variable Answer, this one has to be defined with the Dim command (Dim Answer)

Write a key to a INI File

Syntax:???????????? Object.WSHWriteINI "SectionName",KeyName","Value"," TheINIFile"

Examle:??????????? objadr.WSHWriteINI "Test","Name5","Mr. Thomas Miller","c:\temp\test.ini"
If the key still exist it will overwrite, new keys are created automatically

Read all sections of an INI File

Syntax:???????????? Object.WSHGetSections("TheINIFile")

Example:????????? Answer = objAdr.WSHGetSections("c:\temp\test.ini")
After execute the WSHGetSections the section names are comma separated in the variable Answer, this one has to be defined with the Dim command (Dim Answer)

Read all keys of a section in an INI File

Syntax:???????????? Object.WSHGetKeys("SectionName","TheINIFile")

Example:????????? Answer = objAdr.WSHGetKeys("Test","c:\temp\test.ini")
After execute the WSHGetKeys the key names are comma separated in the variable Answer, this one has to be defined with the Dim command (Dim Answer)

Delete a key in a section of a INI file

Syntax:???????????? Object.WSHINIDelKey "SectionName","KeyName","TheINIFile"

Example:????????? objadr.WSHINIDelKey "Test","Name2","c:\temp\test.ini"

Delete a section of a INI file

Syntax:???????????? Object.WSHINIDelSection "SectionName","TheINIFile"

Example:????????? objadr.WSHINIDelSection "Test2","c:\temp\test.ini"

Sleep the script file

Syntax:???????????? Object.WSHSleep TIMEinMiliseconds

Example:????????? objAdr.WSHSleep 1000
Sleep the Script for one second

 

Example

option Explicit

Dim ObjAdr

Dim Antwort

 

' Declaration of the ActiveX Control

? set ObjAdr = WScript.CreateObject("WSHWIControl.WSHExt")

?

' Read a key from the INI file

? Antwort = objadr.WSHGetINI("Test","Name5","c:\temp\test.ini")

? WScript.Echo "I have read this key form the INI file:" + chr(13) + Antwort

 

' Write to the INI file

? objadr.WSHWriteINI "Test","Name5","Mr. Thomas Miller","c:\temp\test.ini"

? WSCript.Echo "I have write 'Mr. Thomas Miller' to the INI File"

?

' Show all sections of the INI file

? Antwort = objAdr.WSHGetSections("c:\temp\test.ini")

? WScript.Echo "Those sections are in the INI file:" + chr(13) + Antwort

 

' Take a sleep about 1 second

? objAdr.WSHSleep 1000

 

' Show all keys of a section

? Antwort = objAdr.WSHGetKeys("Test","c:\temp\test.ini")

? WScript.Echo "This are the keys of the section Test:" + chr(13) + Antwort

 

' Clear a key in a section of a INI file

? objadr.WSHINIDelKey "Test","Name2","c:\temp\test.ini"

 

' Clear a section in a INI file

? objadr.WSHINIDelSection "Test2","c:\temp\test.ini"

 

' Clear the memory of the Object and exit

? set ObjAdr = Nothing

? WScript.Quit()