AddOS Method

The AddOS method first creates an instance of the Dictionary class and sets the new object with a key/value pair using the strings passed as parameters to the method. It then adds the dispinterface on the new object to the OS collection and returns it.

VBScript Syntax

IImplementation.AddOS os [, version]

Parameters

os

The string used to build the OS XML element's VALUE attribute. This becomes a key in the class Dictionary object.

version

The string used to build the optional OSVERSION XML element's VALUE attribute. This becomes an optional value in the class Dictionary object.

Return Value

The Dictionary object dispinterface storing OS and OSVERSION attribute strings.

Remarks

Each OS and OSVERSION child XML element can be defined within the class Dictionary object. In this case, there are no predefined keys. The string used for each Dictionary key becomes the OS XML element's VALUE attribute, and the string for each associated Dictionary value becomes the OSVERSION XML element's VALUE attribute. The OSVERSION XML element is contained by the OS XML element. For example, assume the Dictionary has the following key/value pairs:

Key Value
MacOS 8.0
WinNT 4.0

When the GetCDFString method is invoked on the class Implementation object, the following XML elements would be added within the IMPLEMENTATION XML element:

<OS VALUE="macos">
<OSVERSION VALUE="8.0"/>
</OS>
<OS VALUE="winnt">
<OSVERSION VALUE="4.0"/>
</OS>

Note the lowercase strings. This is because the class Dictionary object stores all keys in their lowercase form.

Example

' Using Windows Scripting Host and VBScript
Set Impl = CreateObject("Push.Implementation")
Impl.AddOS "WinNT","4.0"
wscript.echo Impl.GetCDFString

produces

<IMPLEMENTATION>
 <OS VALUE="winnt">
  <OSVERSION VALUE="4.0"/>
 </OS>
</IMPLEMENTATION>

See Also

OS Collection


© 1997-1998 Microsoft Corporation. All rights reserved.