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