def click_logout():
    OneX_Window = uiautomation.WindowControl(Name="Avaya one-X® Communicator")
    OneX_Window.SetFocus()
    onex_call = uiautomation.PaneControl(ClassName="ScrollViewer")
    onex_call.SetFocus()
    btn_setting = uiautomation.ButtonControl(AutomationId="ButtonMenu")
    btn_setting.Click()
    Menu = uiautomation.MenuControl(ClassName="ContextMenu")
    Menu.SetFocus()
    choose_logout = Menu.MenuItemControl(Name="Log Out")
    choose_logout.Click()
Beispiel #2
0
def main():
    automation.Logger.WriteLine('请把鼠标放在QQ群聊天窗口中的一个成员上面,3秒后获取\n')
    time.sleep(3)
    listItem = automation.ControlFromCursor()
    if listItem.ControlType != automation.ControlType.ListItemControl:
        automation.Logger.WriteLine('没有放在群成员上面,程序退出!')
        return
    consoleWindow = automation.GetConsoleWindow()
    if consoleWindow:
        consoleWindow.SetActive()
    qqWindow = listItem.GetTopWindow()
    list = listItem.GetParentControl()
    allListItems = list.GetChildren()
    for listItem in allListItems:
        automation.Logger.WriteLine(listItem.Name)
    answer = 'y'
    if answer.lower() == 'y':
        automation.Logger.WriteLine('\n3秒后开始获取QQ群成员详细资料,您可以一直按住F10键暂停脚本')
        time.sleep(3)
        qqWindow.SetActive()
        #确保群里第一个成员可见在最上面
        left, top, right, bottom = list.BoundingRectangle
        while allListItems[0].BoundingRectangle[1] < top:
            automation.Win32API.MouseClick(right - 5, top + 20)
        for listItem in allListItems:
            if listItem.ControlType == automation.ControlType.ListItemControl:
                if automation.Win32API.IsKeyPressed(automation.Keys.VK_F10):
                    if consoleWindow:
                        consoleWindow.SetActive()
                    input('\n您暂停了脚本,按Enter继续\n')
                    qqWindow.SetActive()
                listItem.RightClick()
                menu = automation.MenuControl(searchDepth= 1, ClassName = 'TXGuiFoundation')
                menuItems = menu.GetChildren()
                for menuItem in menuItems:
                    if menuItem.Name == '查看资料':
                        menuItem.Click()
                        break
                automation.Logger.WriteLine('eachpersonstart')
                automation.Logger.WriteLine(listItem.Name, automation.ConsoleColor.Green)
                
                automation.Logger.WriteLine(GetPersonDetail())
                listItem.Click()
                automation.SendKeys('{Down}')
class LoginSuccessWindow:
    #登录后的主窗口
    root_window = uiautomation.PaneControl(searchDepth=1,
                                           ClassName='Qt5QWindowIcon')
    #最上排元素位置
    top_location = root_window.CustomControl(searchDepth=1, foundIndex=1)
    #聊天窗口
    chat_box = top_location.ButtonControl(Name='')
    #用户消息
    user_message = top_location.CustomControl(foundIndex=2, Name='')
    #设置
    account_info = top_location.CustomControl(foundIndex=3)
    setting_options = account_info.MenuItemControl()
    #点击设置后会弹出框,变为主窗口,ClassName为Qt5QWindowPopupDropShadowSaveBits,ControlType=MenuControlTypeId
    setting_root_window = uiautomation.MenuControl(
        ClassName='Qt5QWindowPopupDropShadowSaveBits')
    #设置里的选项
    options = setting_root_window.MenuItemControl(Name='选项')
    #修改密码
    change_pwd_option = setting_root_window.MenuItemControl(Name='修改密码')
    #帮助手册
    help_manual = setting_root_window.MenuItemControl(Name='帮助手册 F1')
    #意见反馈
    feedback = setting_root_window.MenuItemControl(Name='意见反馈')
    #关于选项
    about_option = setting_root_window.MenuItemControl(Name='关于')
    #退出选项
    logout_option = setting_root_window.MenuItemControl(Name='退出')
    #是否退出当前账号弹框
    confirm_to_quit = root_window.PaneControl(ClassName='Qt5QWindow',
                                              foundIndex=1)
    logout_yes = confirm_to_quit.ButtonControl(Name='是 Enter')
    logout_no = confirm_to_quit.ButtonControl(Name='否')
    #fast皮肤设置
    window_skin_setting = top_location.CustomControl(foundIndex=6)
    #fast窗口大小、关闭设置
    setting_window = top_location.CustomControl(foundIndex=5)
    min_window_fast = setting_window.ButtonControl(foundIndex=1)
    max_window_fast = setting_window.ButtonControl(foundIndex=2)
    close_window_fast = setting_window.ButtonControl(foundIndex=3)
Beispiel #4
0
 def mnuFile():
     return automation.MenuControl(Name="File")
    def find(self, ControlTypeName="Control", **kwargs):

        if ControlTypeName == "Control":
            control = auto.Control(**kwargs)

        if ControlTypeName == "ButtonControl":
            control = auto.ButtonControl(**kwargs)

        if ControlTypeName == "CalendarControl":
            control = auto.CalendarControl(**kwargs)

        if ControlTypeName == "CheckBoxControl":
            control = auto.CheckBoxControl(**kwargs)

        if ControlTypeName == "ComboBoxControl":
            control = auto.ComboBoxControl(**kwargs)

        if ControlTypeName == "CustomControl":
            control = auto.CustomControl(**kwargs)

        if ControlTypeName == "DataGridControl":
            control = auto.DataGridControl(**kwargs)

        if ControlTypeName == "DataItemControl":
            control = auto.DataItemControl(**kwargs)

        if ControlTypeName == "DocumentControl":
            control = auto.DocumentControl(**kwargs)

        if ControlTypeName == "EditControl":
            control = auto.EditControl(**kwargs)

        if ControlTypeName == "GroupControl":
            control = auto.GroupControl(**kwargs)

        if ControlTypeName == "HeaderControl":
            control = auto.HeaderControl(**kwargs)

        if ControlTypeName == "HeaderItemControl":
            control = auto.HeaderItemControl(**kwargs)

        if ControlTypeName == "HyperlinkControl":
            control = auto.HyperlinkControl(**kwargs)

        if ControlTypeName == "ImageControl":
            control = auto.ImageControl(**kwargs)

        if ControlTypeName == "ListControl":
            control = auto.ListControl(**kwargs)

        if ControlTypeName == "ListItemControl":
            control = auto.ListItemControl(**kwargs)

        if ControlTypeName == "MenuControl":
            control = auto.MenuControl(**kwargs)

        if ControlTypeName == "MenuBarControl":
            control = auto.MenuBarControl(**kwargs)

        if ControlTypeName == "MenuItemControl":
            control = auto.MenuItemControl(**kwargs)

        if ControlTypeName == "PaneControl":
            control = auto.PaneControl(**kwargs)

        if ControlTypeName == "ProgressBarControl":
            control = auto.ProgressBarControl(**kwargs)

        if ControlTypeName == "RadioButtonControl":
            control = auto.RadioButtonControl(**kwargs)

        if ControlTypeName == "ScrollBarControl":
            control = auto.ScrollBarControl(**kwargs)

        if ControlTypeName == "SemanticZoomControl":
            control = auto.SemanticZoomControl(**kwargs)

        if ControlTypeName == "SeparatorControl":
            control = auto.SeparatorControl(**kwargs)

        if ControlTypeName == "SliderControl":
            control = auto.SliderControl(**kwargs)

        if ControlTypeName == "SpinnerControl":
            control = auto.SpinnerControl(**kwargs)

        if ControlTypeName == "SplitButtonControl":
            control = auto.SplitButtonControl(**kwargs)

        if ControlTypeName == "StatusBarControl":
            control = auto.StatusBarControl(**kwargs)

        if ControlTypeName == "TabControl":
            control = auto.TabControl(**kwargs)

        if ControlTypeName == "TabItemControl":
            control = auto.TabItemControl(**kwargs)

        if ControlTypeName == "TextControl":
            control = auto.TextControl(**kwargs)

        if ControlTypeName == "ThumbControl":
            control = auto.ThumbControl(**kwargs)

        if ControlTypeName == "TitleBarControl":
            control = auto.TitleBarControl(**kwargs)

        if ControlTypeName == "ToolBarControl":
            control = auto.ToolBarControl(**kwargs)

        if ControlTypeName == "ToolTipControl":
            control = auto.ToolTipControl(**kwargs)

        if ControlTypeName == "TreeControl":
            control = auto.TreeControl(**kwargs)

        if ControlTypeName == "TreeItemControl":
            control = auto.TreeItemControl(**kwargs)

        if ControlTypeName == "WindowControl":
            control = auto.WindowControl(**kwargs)

        if control.Exists():
            return control
        else:
            name = kwargs.__str__().replace(":", ":")
            Log.logger().error("元素查找失败%s" % name)
            autogui.screenshot("../log/%s.png" % name)
Beispiel #6
0
def main():
    auto.Logger.WriteLine('请把鼠标放在QQ群聊天窗口中右下角群成员列表中的一个成员上面,3秒后获取\n',
                          auto.ConsoleColor.Cyan,
                          writeToFile=False)
    time.sleep(3)
    listItem = auto.ControlFromCursor()
    if listItem.ControlType != auto.ControlType.ListItemControl:
        auto.Logger.WriteLine('没有放在群成员上面,程序退出!',
                              auto.ConsoleColor.Cyan,
                              writeToFile=False)
        return
    consoleWindow = auto.GetConsoleWindow()
    if consoleWindow:
        consoleWindow.SetActive()
    qqWindow = listItem.GetTopLevelControl()
    list = listItem.GetParentControl()
    allListItems = list.GetChildren()
    for li in allListItems:
        auto.Logger.WriteLine(li.Name)
        pass
    auto.Logger.WriteLine('是否获取成员详细信息?按F9继续,F10退出',
                          auto.ConsoleColor.Cyan,
                          writeToFile=False)
    while True:
        if auto.IsKeyPressed(auto.Keys.VK_F9):
            break
        elif auto.IsKeyPressed(auto.Keys.VK_F10):
            return
        time.sleep(0.05)
    auto.Logger.WriteLine('\n3秒后开始获取QQ群成员详细资料,您可以一直按住F10键暂停脚本',
                          auto.ConsoleColor.Cyan,
                          writeToFile=False)
    time.sleep(3)
    qqWindow.SetActive()
    #确保群里第一个成员可见在最上面
    list.Click()
    list.SendKeys('{Home}', waitTime=1)
    for listItem in allListItems:
        if listItem.ControlType == auto.ControlType.ListItemControl:
            if auto.IsKeyPressed(auto.Keys.VK_F10):
                if consoleWindow:
                    consoleWindow.SetActive()
                auto.Logger.WriteLine('\n您暂停了脚本,按F9继续\n',
                                      auto.ConsoleColor.Cyan,
                                      writeToFile=False)
                while True:
                    if auto.IsKeyPressed(auto.Keys.VK_F9):
                        break
                    time.sleep(0.05)
                qqWindow.SetActive()
            listItem.RightClick(waitTime=2)
            menu = auto.MenuControl(searchDepth=1, ClassName='TXGuiFoundation')
            menuItems = menu.GetChildren()
            for menuItem in menuItems:
                if menuItem.Name == '查看资料':
                    menuItem.Click(40)
                    break
            auto.Logger.WriteLine(listItem.Name, auto.ConsoleColor.Green)
            auto.Logger.WriteLine(GetPersonDetail())
            listItem.Click()
            auto.SendKeys('{Down}')