<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Name="Configuration Tree" Expanded="True" Version="1487" Guid="{991F8D0F-B0EE-41D8-A580-374C6DD96287}" Time="1232722316.0">
    <Autostart Name="Autostart" Expanded="True">
        <Plugin File="Timer" Identifier="Timer">
            gAIpLg==
        </Plugin>
    </Autostart>
    <Folder Name="Toggle NOTEPAD" Expanded="True">
        <Macro Name='Timer: Start timer "toggle_App_every_10_sec"' Expanded="True">
            <Event Name="Main.OnInit" />
            <Action>
                Timer.TimerAction(u'toggle_App_every_10_sec', 0, 0, 10.0, u'check_App', False, True, 0, u'00:00:00')
            </Action>
        </Macro>
        <Macro Name="Python Script" Expanded="True">
            <Event Name="Timer.check_App" />
            <Action>
                Window.FindWindow(u'NOTEPAD.EXE', None, None, None, None, None, False, 0.0, 2)
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(15), 1, False)
            </Action>
            <Action>
                EventGhost.PythonScript(u'from win32gui import GetForegroundWindow\nhwnd = eg.lastFoundWindows\neg.globals.myHwnd = hwnd[:]\nfocusW = GetForegroundWindow()\neg.result = hwnd[0] == focusW\n')
            </Action>
            <Action>
                EventGhost.NewJumpIf(XmlIdLink(18), 1, False)
            </Action>
            <Action>
                Window.Minimize()
            </Action>
        </Macro>
        <Macro Name="Bring to front" id="18" Expanded="True">
            <Action>
                EventGhost.PythonScript(u'import ctypes, win32api, win32gui, win32process\nhwnd = eg.globals.myHwnd[0]\n\nAttachThreadInput = ctypes.windll.user32.AttachThreadInput\nremoteThreadId = win32process.GetWindowThreadProcessId(hwnd)[0]\ncurrentThreadId = win32api.GetCurrentThreadId()\nif AttachThreadInput(remoteThreadId, currentThreadId, True)&gt;0:\n    try:\n        win32gui.ShowWindow(hwnd,1)\n        win32gui.SetForegroundWindow(hwnd)\n    except:\n        pass\n    finally:\n        AttachThreadInput(remoteThreadId, currentThreadId, False)\n')
            </Action>
        </Macro>
        <Macro Name="Start Program: NOTEPAD.EXE" id="15" Expanded="True">
            <Action>
                System.Execute(u'C:\\WINDOWS\\NOTEPAD.EXE', u'', 0, False, 2, u'')
            </Action>
        </Macro>
    </Folder>
</EventGhost>
