Python Automation GUI3: check a handle available

import WindowGuiAuto
import win32api
def get_handle_object(window_class=None,window_name=None,object_name=None,object_type=None,timeout=200):
EnumChildHandle = []
hwnd = WindowGuiAuto.findTopWindow(wantedText=window_name, wantedClass=window_class)
win32gui.EnumChildWindows(hwnd, all_ok, EnumChildHandle)
for handle in EnumChildHandle:
    if object_type in win32gui.GetClassName(handle):
        if HwndWrapper(handle).Texts()[0] != None:
            if object_name in HwndWrapper(handle).Texts()[0]:
                return True
return False

def all_ok(hwnd, child_handles):
        child_handles.append(hwnd)
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s