コード例 #1
0
 def SetWindowPosAndSize(self):
     x1 = self.spinOffsetX.GetValue()
     y1 = self.spinOffsetY.GetValue()
     w = self.spinW.GetValue()
     h = self.spinH.GetValue()
     x2 = x1 + w
     y2 = y1 + h
     
     try:
         progName, title = make_tuple(self.cboxWindow.GetValue())
     except:
         return
     kwargs = self.GetMatchKwargs()    
     handles = winman.GetHandles(progName, title, **kwargs)
     if not handles:
         return
         
     for handle in handles:
         try:
             winman.MoveWindow(handle, x1, y1, w, h)
         except Exception as e:
             print(e)
             return
         
     self.Raise()
コード例 #2
0
def MouseClickAbsolute(kwargs):
    progName, title = make_tuple(kwargs["window"])
    handles = winman.GetHandles(progName, title, **kwargs)
    x1, y1, w, h = kwargs["offsetx"], kwargs["offsety"], kwargs["width"], kwargs["height"]
    x, y = int(kwargs["x"]), int(kwargs["y"])
    for handle in handles:
        winman.RestoreWindow(handle)
        if kwargs["resize"] is True:
            winman.MoveWindow(handle, x1, y1, w, h)
            winman.SetForegroundWindow(handle)
        winman.LeftMouseClick(x, y)
コード例 #3
0
def CloseWindow(kwargs):
    """
    Get handles and their respective titles. If condition is
    matched, try to close window by handle
    """
    progName, title = make_tuple(kwargs["window"])
    handles = winman.GetHandles(progName, title, **kwargs)
    print("handles", handles)
    for handle in handles:
        winman.CloseWindow(handle)
    return
コード例 #4
0
 def GetWindowRect(self):
     try:
         progName, title = make_tuple(self.cboxWindow.GetValue())
     except: 
         return
         
     kwargs = self.GetMatchKwargs()
     handles = winman.GetHandles(progName, title, **kwargs)
     if not handles:
         return
         
     for handle in handles:
         x1, y1, x2, y2 = winman.GetWindowRect(handle)
         return x1, y1, x2, y2
コード例 #5
0
def MouseClickRelative(kwargs):
    progName, title = make_tuple(kwargs["window"])
    handles = winman.GetHandles(progName, title, **kwargs)
    x1, y1, w, h = kwargs["offsetx"], kwargs["offsety"], kwargs["width"], kwargs["height"]
    x, y = x1 + int(kwargs["%width"] * w * 0.01), y1 + int(kwargs["%height"] * h * 0.01)
    for handle in handles:
        winman.RestoreWindow(handle)
        winman.SetForegroundWindow(handle)
        if kwargs["resize"] is True:
            winman.MoveWindow(handle, x1, y1, w, h)
        else:
            # calculate new relative positon
            x1, y1, w, h = winman.GetWindowRect(handle)
            x, y = x1 + int(kwargs["%width"] * w * 0.01), y1 + int(kwargs["%height"] * h * 0.01)
            
        winman.LeftMouseClick(x, y)
コード例 #6
0
    def GetWindowRect(self):
        try:
            progName, title = make_tuple(self.cboxWindow.GetValue())
        except:
            return

        kwargs = {
            "matchcondition": self.cboxMatch.GetSelection(),
            "matchcase": self.chkMatchTitleCase.GetValue(),
            "matchstring": self.chkMatchTitle.GetValue(),
            "matches": self.cboxMatches.GetValue(),
        }
        handles = winman.GetHandles(progName, title, **kwargs)
        if not handles:
            return

        for handle in handles:
            x1, y1, x2, y2 = winman.GetWindowRect(handle)
            return x1, y1, x2, y2
コード例 #7
0
def FindWindow(kwargs):
    progName, title = make_tuple(kwargs["window"])
    if winman.GetHandles(progName, title, **kwargs) == []:
        return False
    return True