def main(args): if args.time > 0: time.sleep(args.time) start = time.clock() if args.active: c = automation.GetForegroundControl() elif args.cursor or args.up: c = automation.ControlFromCursor() elif args.fullscreen: c = automation.GetRootControl() CaptureControl(c, args.path, args.up) automation.Logger.WriteLine('cost time: {:.3f} s'.format(time.clock() - start))
def main(): treeItem = automation.ControlFromCursor() if isinstance(treeItem, automation.TreeItemControl) or isinstance( treeItem, automation.TreeControl): while ExpandFromRoot: if isinstance(treeItem, automation.TreeControl): break treeItem = treeItem.GetParentControl() ExpandTreeItem(treeItem) else: automation.Logger.WriteLine( 'the control under cursor is not a tree control', automation.ConsoleColor.Yellow)
def main(): print('请把鼠标放在QQ群聊天窗口中的一个成员上面,3秒后获取\n') time.sleep(3) listItem = automation.ControlFromCursor() if listItem.ControlType != automation.ControlType.ListItemControl: print('没有放在群成员上面,程序退出!') return consoleWindow = automation.GetConsoleWindow() consoleWindow.SetActive() qqWindow = listItem.GetTopWindow() list = listItem.GetParentControl() allListItems = list.GetChildren() for listItem in allListItems: automation.Logger.WriteLine(listItem.Name) answer = input('是否获取详细信息?按y和Enter继续\n') if answer.lower() == 'y': print('\n3秒后开始获取QQ群成员详细资料,您可以一直按住F10键暂停脚本') time.sleep(3) qqWindow.SetActive() time.sleep(0.5) #确保群里第一个成员可见在最上面 left, top, right, bottom = list.BoundingRectangle while allListItems[0].BoundingRectangle[1] < top: automation.Win32API.MouseClick(right - 5, top + 20) time.sleep(0.5) for listItem in allListItems: if listItem.ControlType == automation.ControlType.ListItemControl: if automation.Win32API.IsKeyPressed(automation.Keys.VK_F10): consoleWindow.SetActive() input('\n您暂停了脚本,按Enter继续\n') qqWindow.SetActive() time.sleep(0.5) 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(listItem.Name, automation.ConsoleColor.Green) automation.Logger.WriteLine(GetPersonDetail()) listItem.Click() time.sleep(0.5) automation.SendKeys('{Down}') time.sleep(0.5)
def main(): treeItem = automation.ControlFromCursor() CollapseTreeItem(treeItem)