Reference · reference
com module (Windows)
use com drives late-bound COM objects through IDispatch, and runs WMI queries. The module is registered on every platform so a playbook compiles and validates identically everywhere; on Linux and macOS every call returns a runtime error. Every function and method returns Result[…, string]. Worker threads are initialised as single-threaded apartments by the engine, so a script never deals with COM lifetime or apartment setup.
create
create
Creates a COM object from a ProgID such as WScript.Shell.
get_object
get_object
Binds a moniker, such as winmgmts://./root/cimv2, or a running object, in the way GetObject does.
wmi_query
wmi_query
Runs a WQL query against root\cimv2 and returns a list of maps, one map per result row, keyed by property name.
ComObject
An opaque handle to a COM object. Arguments and results cross as the Value type. A result that is itself an object cannot be held in a Value, so fetch it through get_object, call_object or items.
| Method | Signature | Summary |
|---|---|---|
| get | (name: string) -> Result[Value, string] | read a property |
| get_object | (name: string) -> Result[ComObject, string] | read a property that is an object |
| set | (name: string, value: Value) -> Result[unit, string] | write a property |
| call | (name: string, args: List[Value]) -> Result[Value, string] | invoke a method |
| call_object | (name: string, args: List[Value]) -> Result[ComObject, string] | invoke a method that returns an object |
| items | () -> Result[List[ComObject], string] | enumerate a collection |
use com
use value
wmi_query
}