def goto_task_winkey(self, number): """switch to task with number, via the windows key""" ## print 'action: goto task: %s'% number prog, title, topchild, windowHandle = natqh.getProgInfo() if prog == 'explorer' and not title: keystroke('{esc}') natqh.shortWait() try: count = int(number) except ValueError: print 'goto_task_winkey, invalid number: %s' % number return if not count: print 'goto_task_winkey, invalid number: %s' % number return elif count == 10: count = 0 elif count > 10: print 'goto_task_winkey, pass on to "TASK %s", number > 9' % count return action('TASK %s' % count) self.doWinKey('b') actions.do_VW() self.doWinKey(str(number)) print 'self.winkeyDown: %s' % self.winkeyDown
def goto_task_winkey(self, number): """switch to task with number, via the windows key""" ## print 'action: goto task: %s'% number prog, title, topchild, windowHandle = natqh.getProgInfo() if prog == 'explorer' and not title: keystroke('{esc}') natqh.shortWait() try: count = int(number) except ValueError: print 'goto_task_winkey, invalid number: %s'% number return if not count: print 'goto_task_winkey, invalid number: %s'% number return elif count == 10: count=0 elif count > 10: print 'goto_task_winkey, pass on to "TASK %s", number > 9'% count return action('TASK %s'% count) self.doWinKey('b') actions.do_VW() self.doWinKey(str(number)) print 'self.winkeyDown: %s'% self.winkeyDown
def doWinKey(self, keys, keepdown=None): """do a winkey and return the window info of the resulting window """ winkey = win32con.VK_LWIN # 91 keyup = win32con.KEYEVENTF_KEYUP # 2 win32api.keybd_event(winkey, 0, 0, 0) # key down try: actions.do_SSK(keys) actions.do_VW() classInfo = natqh.getClassName() finally: if classInfo == 'TaskListThumbnailWnd': #print 'keep logo key down' self.winkeyDown = 1 else: win32api.keybd_event(winkey, 0, keyup, 0) # key up