LogoLogo
LogoLogo
  • Welcome
  • Introduction
  • Beginning
    • Server Configuration
    • Sidebar
    • Binaries
  • Client Executables
    • client.exe
    • chaiCmd.exe
    • rmService.exe
  • Modules
    • Module Configuration
    • Inventory
    • File
    • PST
    • Custom
    • Server
    • Folder Lists
    • Own Blob Storage
  • Groups
    • Groups General Overview
    • Groups Configurations
  • Clients Menu
    • Overview
    • Client Information
    • Module Information
  • Reporting
    • Reporting
    • Customize Reports
  • Recipes
    • Group based actions
    • Time based actions
    • Set bandwidth
    • Dump Config
    • Remove PSTs
    • Server Module Scripting
    • Self Service
  • ChaiScript Reference
    • ChaiScript Overview
    • GK Script Object Reference
      • Module Reference
      • HTTP Reference
      • Web Browser
      • File System
      • Graph Reference
      • MS Graph Authentication
      • Hash Reference
      • Registry Reference
      • COM
      • Self Update Reference
Powered by GitBook
On this page
  • Object creation
  • ComObject class

Was this helpful?

  1. ChaiScript Reference
  2. GK Script Object Reference

COM

Object creation

Script
Function

ComObject gkScript.createComObject(string id, bool inProcess)

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

enum InvokeTypes {
    DISPATCH_METHOD,
    DISPATCH_PROPERTYGET,
    DISPATCH_PROPERTYPUT,
    DISPATCH_PROPERTYPUTREF
};


class ComObject
{
    bool connected();          // return true if ComObject is connected to COM server
    void disconnect();

    value invoke(string name, vector params);              // invoke a function
    value invoke(string name, InvokeTypes type, vector params);              // invoke a function with specified invoke type
    value getProp(string prop);                            // read property
    bool setProp(string prop, val);                        // write property
}

Sample:

eval> var inet = gkScript.createComObject("InternetExplorer.Application", false);
eval> inet.connected();
true
eval> inet.setProp("Visible", true);
true
eval> inet.getProp("HWND");
3736394
eval> 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 Close
eval> inet.invoke("Quit", []);
eval> inet.connected()
true
eval> inet.disconnect()
eval> inet.connected()
false
eval>

Last updated 1 year ago

Was this helpful?