def get_window_by_caption(caption):
    """
    finds the window by caption and returns handle (int)
    """
    try:
        hwnd = win32gui.FindWindow(None, caption)
        return hwnd
    except Exception as ex:
        print('error calling win32gui.FindWindow ' + str(ex))
        return -1
finds the window by caption and returns handle (int)