Example #1
0
def set_foreground_window():
    w = user._app.top_window()
    #bring window into foreground
    if w.HasStyle(win32defines.WS_MINIMIZE): # if minimized
        ShowWindow(w.wrapper_object(), 9) # restore window state
    else:
        SetForegroundWindow(w.wrapper_object()) #bring to front
Example #2
0
def ths_restore():
    main_window = pywinauto.application.Application().connect(
        title=u'网上股票交易系统5.0').top_window()
    if main_window.HasStyle(win32defines.WS_MINIMIZE):  # if minimized
        ShowWindow(main_window.wrapper_object(), 9)  # restore window state
    else:
        SetForegroundWindow(main_window.wrapper_object())  # bring to front
Example #3
0
 def positionBrowser(self):
     window = self.currentWindow
     info = window.WrapperObject()
     window.MoveWindow(0, 0, 1347, 1028)
     SetForegroundWindow(info.handle)
     ShowWindow(info.handle, 5)
     SetFocus(info.handle)
     SetActiveWindow(info.handle)
Example #4
0
def WindowInFront(processpath):
    #Bring window in front
    app = Application().connect(path=processpath)
    w = app.top_window()

    #bring window into foreground
    if w.HasStyle(win32defines.WS_MINIMIZE):  # if minimized
        ShowWindow(w.wrapper_object(), 9)  # restore window state
    else:
        SetForegroundWindow(w.wrapper_object())  #bring to front
Example #5
0
def cut(save_picture=True):
    hwnd = find_window(title=FGO窗口名)
    ShowWindow(hwnd, SW_RESTORE)
    SetForegroundWindow(hwnd)

    # 截取FGO主窗口截图
    left, top, right, bottom = GetWindowRect(hwnd)
    src_image = ImageGrab.grab((left, top, right, bottom))

    src_image = src_image.convert('L').convert('RGB')
    if save_picture:
        src_image.save('pic.png')
        print("截图已完成……")
    return np.array(src_image)
Example #6
0
def goto_app(name):
    # app = Application().connect(path="C:\\Program Files (x86)\\Google\\Chrome\\Application\\chrome.exe")
    # try:
    app = Application().connect(title_re=".*" + name.strip() + ".*")
    # except Exception as e:
    # 	print( "Error:: goto_app(): ", sys.exc_info()[0])
    # 	os._exit(1)

    print("IS HERE")
    w = app.top_window()
    #bring window into foreground
    if w.has_style(win32defines.WS_MINIMIZE):  # if minimized
        ShowWindow(w.wrapper_object(), 9)  # restore window state
    else:
        SetForegroundWindow(w.wrapper_object())  #bring to front
Example #7
0
def run_CAN_simulator():
    os.system(r".\su_tool\RunCAN_Simulator.bat")
    time.sleep(2)
    app = Application().connect(path=r".\su_tool\MBC_CAN-rx_Simulator.exe")
    w = app.top_window()
    if w.HasStyle(win32defines.WS_MINIMIZE):  # if minimized
        ShowWindow(w.wrapper_object(), 9)  # restore window state
    else:
        SetForegroundWindow(w.wrapper_object())  #bring to front
    wsh = comclt.Dispatch("WScript.Shell")
    for count in range(0, 9):
        wsh.SendKeys("{+}")
    time.sleep(1)
    wsh.SendKeys("{2}")
    for count in range(0, 9):
        wsh.SendKeys("{+}")
Example #8
0
try:
    browser = AutoApp().connect(title_re=".*Mozilla")
except:
    print("Can't find mozilla firefox")
    exit()

window = browser.top_window()
info = window.WrapperObject()
rect = info.rectangle()
oldX = -1
oldY = -1

try:
    window.MoveWindow(0, 0, 1347, 1028)
    SetForegroundWindow(info.handle)
    ShowWindow(info.handle, 5)
    SetFocus(info.handle)
    SetActiveWindow(info.handle)
except Exception as e:
    print(e)


class Capture(Singleton):
    def firstTime(self, **kwargs):
        self.keys = []
        self.captureToggle = False
        self.lock = Lock()
        basedir = os.path.abspath(os.path.dirname(__file__))
        self.imagedir = basedir + '\\' + 'images'
        os.makedirs(self.imagedir, exist_ok=True)
Example #9
0
 def set_foreground(self):
     # SET WINDOW TO FOREGROUND, MAXIMIZE WINDOW
     win32gui.SetForegroundWindow(self._handle)
     ShowWindow(self._handle, SW_MAXIMIZE)
Example #10
0
def wincheck():
    #bring window into foreground
    if w.HasStyle(win32defines.WS_MINIMIZE): # if minimized
        ShowWindow(w.wrapper_object(), 9) # restore window state
    else:
        SetForegroundWindow(w.wrapper_object()) #bring to front
Example #11
0
 def restoreWindow(self):
     if self.__main_window.has_style(win32defines.WS_MINIMIZE): # if minimized
         ShowWindow(self.__main_window.wrapper_object(), 9) # restore window state
     else:
         SetForegroundWindow(self.__main_window.wrapper_object()) # bring to front