DeviceCollection.AddDevice
 
 
 

DeviceCollection.AddDevice

Description

Adds a new device driver to the list in the device manager. Before you can use a device driver, you need to create a Device object using this method.

C# Syntax

Device DeviceCollection.AddDevice( String in_bstrDeviceName );

Scripting Syntax

oReturn = DeviceCollection.AddDevice( DeviceName );

Return Value

Device

Parameters

Parameter Type Description
DeviceName String The name of the device to add.

Examples

JScript Example

/*
        This example demonstrates how to work with devices through scripting.
*/
NewScene( null, false );
// First make sure the device manager is active (we can't add devices if it isn't)
if (!Application.Devices.Enable) {
        Application.Devices.Enable = true;
}
// Get the DeviceManager (DeviceCollection)
var oDevices = Application.Devices;
// Get a pointer to the PC1600 Device, if it exists
var oDevice = oDevices.Item("PC1600");
// If it doesn't exist, then create it
if (oDevice == null) {
        oDevice = oDevices.AddDevice( "PC1600" );
}
LogMessage( "The device name is " + oDevice );
//INFO : The device name is DeviceManager.PC1600

See Also

DeviceCollection.RemoveDevice