Example #1
0
  def WatchForWindowClose(self, hwnd, name=None, survive=False):
    '''
    Watch for a window to close.

    @param hwnd: Handle of the window that should close
    @type hwnd: number
    @param name: Name of the case where the window actually closes
    @type name: string
    @param survive: Does this watcher survive throughout the macro?
    @type survive: boolean
    '''
    cond = EventManager.addCondition(pyAA.Constants.EVENT_OBJECT_DESTROY,
                                     _onTest, None, Window=hwnd)
    cond.setListener(self.Continue, name)
    self.conditions[cond] = survive
Example #2
0
  def WatchForEvents(self, events, name=None, survive=False, **features):
    '''
    Watches for stated window events with the given features.

    @param events: List of events to watch
    @type events: list
    @param name: Name of the case where the window actually closes
    @type name: string
    @param survive: Does this watcher survive throughout the macro?
    @type survive: boolean
    @param features: Other features to monitor, given by their AA property name
    @type features: dictionary of string, regex, or callable
    '''
    pid = self._getPID()
    # register the features for all events
    for event in events:
      cond = EventManager.addCondition(event, _onTest, pid, **features)
      #cond.setListener(self.Continue, name)
      self._awaitingConditions.append((cond, name))
      self.conditions[cond] = survive