def main():
    automation.Logger.WriteLine('Press Ctrl+1 to start, press ctrl+4 to stop')
    automation.RunWithHotKey(
        {
            (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_1): test1,
            (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_2): test2
        }, (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_4))
Example #2
0
        if stopEvent.is_set():
            childProcess = []
            for pid, pname in automation.Win32API.EnumProcess():
                ppid = automation.Win32API.GetParentProcessId(pid)
                if ppid == p.pid or pid == p.pid:
                    cmd = automation.Win32API.GetProcessCommandLine(pid)
                    childProcess.append((pid, pname, cmd))
            for pid, pname, cmd in childProcess:
                automation.Logger.WriteLine(
                    'kill process: {}, {}, "{}"'.format(pid, pname, cmd),
                    automation.ConsoleColor.Yellow)
                automation.Win32API.TerminateProcess(pid)
            break
        stopEvent.wait(1)
    automation.Logger.WriteLine('ShowWindowFunc exit')


if __name__ == '__main__':
    if 'hide' in sys.argv[1:]:
        hide()
    elif 'show' in sys.argv[1:]:
        show()
    else:
        automation.RunWithHotKey(
            {
                (automation.ModifierKey.MOD_CONTROL | automation.ModifierKey.MOD_SHIFT, automation.Keys.VK_1):
                HideWindowFunc,
                (automation.ModifierKey.MOD_CONTROL | automation.ModifierKey.MOD_SHIFT, automation.Keys.VK_2):
                ShowWindowFunc
            }, (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_4))
        parser = argparse.ArgumentParser()
        parser.add_argument('main', help='exec main')
        parser.add_argument('-d',
                            '--depth',
                            type=int,
                            default=0xFFFFFFFF,
                            help='max expand tree depth')
        parser.add_argument('-r',
                            '--root',
                            action='store_true',
                            help='expand from root')
        parser.add_argument('-p',
                            '--print',
                            action='store_true',
                            help='print tree node text')
        args = parser.parse_args()
        #automation.Logger.WriteLine(str(args))
        ExpandFromRoot = args.root
        MaxExpandDepth = args.depth
        PrintTree = args.print
        main()
    else:
        automation.Logger.WriteLine(
            'move mouse to a tree control and press Ctrl+1',
            automation.ConsoleColor.Green)
        automation.RunWithHotKey(
            {
                (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_1):
                HotKeyFunc
            }, (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_2))
Example #4
0
def main():
    automation.RunWithHotKey(
        {
            (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_1): test1,
            (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_2): test2
        }, (automation.ModifierKey.MOD_CONTROL, automation.Keys.VK_4))