title: how to get the name and value of a GUI object in Python after click
body: <p>I want to record a user scenario of a windows application. For this I want to retrieve/log the object type, the object name and the object value of GUI objects after a mouse click on the object next to a screen capture and the mouse position.</p>
  
  <p>I am stucked with finding the how to's. Please help. </p>
  
  <p>I have the following Python code. </p>
  
  <pre><code>saveDir = r'C:\Privat\ZuppU\temp'
  stepListID = 1
  
  
  def capture_step_objects(event):
      global stepListID
      stepEvent = 'Click'
  
      # Capture the application mouseclick area
      (mx, my) = event.Position
  
      fgWindow = win32gui.GetForegroundWindow()
      fgWindowName = win32gui.GetWindowText(fgWindow)
  
      # Capture the application window
      (ax1, ay1, ax2, ay2) = win32gui.GetWindowRect(fgWindow)
      stepCapture = ImageGrab.grab((ax1, ay1, ax2, ay2))
      stepImage = os.path.join(saveDir, 'Step' + str(stepListID) + '.png')
      stepCapture.save(stepImage)
  
  hm = pyHook.HookManager()
  hm.SubscribeMouseAllButtonsDown(capture_step_objects)
  hm.HookMouse()
  pythoncom.PumpMessages()
  hm.UnhookMouse()
  
  # Main loop
  </code></pre>