ComObjCreate() [AHK_L 53+]

Creates a COM object.

ComObject := ComObjCreate(CLSID , IID)

Parameters

CLSID

CLSID or human-readable Prog ID of the COM object to create.

IID

[v1.0.96.00+]: The identifier of an interface the object supports.

Return Value

On failure, the function may throw an exception, exit the script or return an empty string, depending on the current ComObjError() setting and other factors.

If an IID is specified, an interface pointer is returned. The script must typically call ObjRelease() when it is finished with the pointer.

Otherwise, a wrapper object usable by script is returned. See object syntax.

ComObjGet(), ComObjActive(), ComObjConnect(), ComObjArray(), ComObjError(), ComObjQuery(), CreateObject (Microsoft Docs)

Examples

For a constantly growing list of examples, see the following forum topic: https://www.autohotkey.com/forum/topic61509.html.

Launches an instance of Internet Explorer, makes it visible and navigates to a website.

ie := ComObjCreate("InternetExplorer.Application")
ie.Visible := true  ; This is known to work incorrectly on IE7.
ie.Navigate("https://www.autohotkey.com/")