How to use the comtypes.automation.VARIANT function in comtypes

To help you get started, we’ve selected a few comtypes examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github enthought / comtypes / comtypes / __init__.py View on Github external
def _is_object(obj):
    """This function determines if the argument is a COM object.  It
    is used in several places to determine whether propputref or
    propput setters have to be used."""
    from comtypes.automation import VARIANT
    # A COM pointer is an 'Object'
    if isinstance(obj, POINTER(IUnknown)):
        return True
    # A COM pointer in a VARIANT is an 'Object', too
    elif isinstance(obj, VARIANT) and isinstance(obj.value, POINTER(IUnknown)):
        return True
    # It may be a dynamic dispatch object.
    return hasattr(obj, "_comobj")
github phuslu / pyMSAA / msaa.py View on Github external
def accSelection(self):
        '''Get Element Selection Status'''
        objChildren = comtypes.automation.VARIANT()
        self.IAccessible._IAccessible__com__get_accSelection(ctypes.byref(objChildren))
        return objChildren.value
github phuslu / pyMSAA / msaa.py View on Github external
def accDescription(self):
        '''Get Element Description'''
        objChildId = comtypes.automation.VARIANT()
        objChildId.vt = comtypes.automation.VT_I4
        objChildId.value = self.iObjectId
        objDescription = comtypes.automation.BSTR()
        self.IAccessible._IAccessible__com__get_accDescription(objChildId, ctypes.byref(objDescription))
        return objDescription.value
github phuslu / pyMSAA / msaa.py View on Github external
def accState(self):
        '''Get Element State'''
        objChildId = comtypes.automation.VARIANT()
        objChildId.vt = comtypes.automation.VT_I4
        objChildId.value = self.iObjectId
        objState = comtypes.automation.VARIANT()
        self.IAccessible._IAccessible__com__get_accState(objChildId, ctypes.byref(objState))
        return objState.value
github F1ashhimself / UISoup / uisoup / win_soup / element.py View on Github external
def _acc_state(self):
        obj_child_id = comtypes.automation.VARIANT()
        obj_child_id.vt = comtypes.automation.VT_I4
        obj_child_id.value = self._i_object_id
        obj_state = comtypes.automation.VARIANT()
        self._i_accessible._IAccessible__com__get_accState(
            obj_child_id, ctypes.byref(obj_state))

        return obj_state.value
github phuslu / pyMSAA / msaa.py View on Github external
def accValue(self, objValue=None):
        '''Get Element Value'''
        objChildId = comtypes.automation.VARIANT()
        objChildId.vt = comtypes.automation.VT_I4
        objChildId.value = self.iObjectId
        objBSTRValue = comtypes.automation.BSTR()
        if objValue is None:
            self.IAccessible._IAccessible__com__get_accValue(objChildId, ctypes.byref(objBSTRValue))
            return objBSTRValue.value
        else:
            objBSTRValue.value = objValue
            self.IAccessible._IAccessible__com__set_accValue(objChildId, objValue)
            return objBSTRValue.value
github F1ashhimself / UISoup / uisoup / win_soup / element.py View on Github external
def _role(self):
        """
        Property for element role.
        """
        obj_child_id = comtypes.automation.VARIANT()
        obj_child_id.vt = comtypes.automation.VT_I4
        obj_child_id.value = self._i_object_id
        obj_role = comtypes.automation.VARIANT()
        obj_role.vt = comtypes.automation.VT_BSTR

        self._i_accessible._IAccessible__com__get_accRole(obj_child_id,
                                                          obj_role)

        return obj_role.value
github F1ashhimself / UISoup / uisoup / win_soup / win_soup.py View on Github external
def get_object_by_coordinates(self, x, y):
        obj_point = ctypes.wintypes.POINT()
        obj_point.x = x
        obj_point.y = y
        i_accessible = ctypes.POINTER(comtypes.gen.Accessibility.IAccessible)()
        obj_child_id = comtypes.automation.VARIANT()
        ctypes.oledll.oleacc.AccessibleObjectFromPoint(
            obj_point,
            ctypes.byref(i_accessible),
            ctypes.byref(obj_child_id))

        return WinElement(i_accessible, obj_child_id.value or 0)