コード例 #1
0
ファイル: _window.py プロジェクト: kb100/dragonfly-scripts
def print_all_window_details():
    for window in Window.get_all_windows():
        if window.is_visible:
            window = Window.get_foreground()
            logger.info('Window details')
            logger.info('title=' + window.title)
            logger.info('executable=' + window.executable)
コード例 #2
0
def clear_log():
    # Function to clear natlink status window
    try:
        # pylint: disable=import-error
        import natlink
        windows = Window.get_all_windows()
        matching = [w for w in windows
        if b"Messages from Python Macros" in w.title]
        if matching:
            handle = (matching[0].handle)
            rt_handle = win32gui.FindWindowEx(handle, None, "RICHEDIT", None)
            win32gui.SetWindowText(rt_handle, "")
            return
    except Exception as e:
        printer.out(e)
コード例 #3
0
ファイル: _window.py プロジェクト: kb100/dragonfly-scripts
 def _process_recognition(self, node, extras):
     name = extras['name'].format().lower()
     windows = [w for w in Window.get_all_windows() if w.is_visible]
     names = [w.executable.lower() for w in windows]
     names += [w.title.lower() for w in windows]
     matches = get_close_matches(name, names, 10, 0.1)
     matches = self.clean_unwanted_matches(matches, name)
     if not matches: return
     for window in windows:
         if matches[0] in [window.executable.lower(), window.title.lower()]:
             # In Windows, this is not guaranteed to work. See:
             # http://stackoverflow.com/questions/688337/how-do-i-force-my-app-to-come-to-the-front-and-take-focus
             # http://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).asp
             window.set_foreground()
             return
コード例 #4
0
ファイル: _window.py プロジェクト: ccrusius/dragonfly-modules
 def _process_recognition(self,node,extras):
     name=extras['name'].format().lower()
     windows=[w for w in Window.get_all_windows() if w.is_visible ]
     names=[w.executable.lower() for w in windows]
     names+=[w.title.lower() for w in windows]
     matches=get_close_matches(name,names,10,0.1)
     matches=self.clean_unwanted_matches(matches,name)
     if not matches: return
     for window in windows:
         if matches[0] in [window.executable.lower(),window.title.lower()]:
             # In Windows, this is not guaranteed to work. See:
             # http://stackoverflow.com/questions/688337/how-do-i-force-my-app-to-come-to-the-front-and-take-focus
             # http://msdn.microsoft.com/en-us/library/windows/desktop/ms633539(v=vs.85).asp                
             window.set_foreground()
             return
コード例 #5
0
ファイル: actions2.py プロジェクト: Solar-Plexus/caster
 def attempt_focus():
     for win in Window.get_all_windows():
         w=win
         found_match=True
         if title!=None:
             found_match=title in w.title
         if found_match and executable!=None:
             found_match=executable in w.executable
         if found_match:
             try:
                 BringApp(w.executable).execute()
             except Exception:
                 print("Unable to set focus:\ntitle: "+w.title+"\nexe: "+w.executable)
             break
      
     # do not assume that it worked
     success = SuperFocusWindow.focus_was_success(title, executable)
     if not success:
         if title!=None:
             print("title failure: ", title, w.title)
         if executable!=None:
             print("executable failure: ", executable, w.executable, executable in w.executable)
     return success
コード例 #6
0
ファイル: actions2.py プロジェクト: Solar-Plexus/caster
 def path_from_executable(executable):
     for win in Window.get_all_windows():
         if executable in win.executable:
             return win.executable