Will create a COM object.
- id can be a CLSID or a ProgID
- Set inProcess to true for in-process objects, false for local servers.
ComObject gkScript.getComObject(string id)
Will attach to a running COM server.
- id can be a CLSID, a ProgID or a Moniker
ComObject class
enumInvokeTypes { DISPATCH_METHOD, DISPATCH_PROPERTYGET, DISPATCH_PROPERTYPUT, DISPATCH_PROPERTYPUTREF};classComObject{boolconnected(); // return true if ComObject is connected to COM servervoiddisconnect();valueinvoke(string name,vector params); // invoke a function value invoke(string name, InvokeTypes type, vector params); // invoke a function with specified invoke type
valuegetProp(string prop); // read propertyboolsetProp(string prop,val); // write property}
Sample:
eval> varinet=gkScript.createComObject("InternetExplorer.Application",false);eval> inet.connected();trueeval> inet.setProp("Visible",true);trueeval> inet.getProp("HWND");3736394eval> inet.invoke("Navigate", ["http://www.google.de"])eval> inet.invoke("Close", [])[2018-02-23 11:29:43.892] [9516] [error] [Default] gkScript::getProp can't get id for Closeeval> inet.invoke("Quit", []);eval> inet.connected()trueeval> inet.disconnect()eval> inet.connected()falseeval>