Command Prompt for Windows




Command COM

Function:

Call a COM object method and (optionally) store the result into an environment variable.

Syntax:

COM var=CreateObject(name[, server])
or
COM [var=]obj.method([params, ...])
varEnvironment variable to store a COM object methods return value.
nameString that specifies the name of the COM object to create.
serverString that specifies the name of the remote server to create the COM object on.
objEnvironment variable that contains a valid handle to a COM object.
methodSpecifies the name of the COM object method to call.
paramsSpecifies the parameters to pass to the COM object method.

Note:

Parameter server is optional and when specified a remote server needs to be correctly setup to allow a COM object to be created on the remote server, otherwise a suitable error message is display instead.

Parameter params can be any of the following :-

environment variable- name of an environment variable containing a sequence of characters.
string- sequence of characters enclosed in double quotes.
number- a valid integer or real.
@true- boolean value for true. eg, -1
@false- boolean value for false. eg, 0
@null- pointer value for NULL. eg. 0

Internally, the WinOne® Command Prompt will convert from one type to another type, as the COM object requires. For example, if a COM object is expecting an integer and the string "10" is passed instead, the WinOne® Command Prompt will automatically attempt to convert the string into an integer and so on. If the value specified can not be successfully converted to the correct type then a suitable error message is displayed.

Arrays returned from COM object methods are stored in the equivalent multi-dimensional environment variable.

Also see command COG, COP and Automation.