Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Task Switching in Windows ???

If you have a question or need help, this is the place to be.
Post Reply
User
Posts: 47
Joined: Sun May 11, 2008 12:56 pm

Task Switching in Windows ???

Post by User »

Hi!

I don't know if I'm missing something, but how do you switch tasks in windows with Eventghost? I can't find any Action that does this, so I think I have to use Key-Emulation. TO switch a Task in Windows you have to Press&Hold down Alt and press the Tabulator-key several times.

So I would need a python command, which presses Tabulator and sets the Alt-Key pressed. And a Second Python command, which simply releases the Alt-key.

Can someone help me please ?
User avatar
topix
Experienced User
Posts: 441
Joined: Sat May 05, 2007 3:43 pm
Location: Germany
Contact:

Re: Task Switching in Windows ???

Post by topix »

Use the 'find window' and 'bring to front' actions.
User
Posts: 47
Joined: Sun May 11, 2008 12:56 pm

Re: Task Switching in Windows ???

Post by User »

Hi!

Thanks for the reply, but I have to specify a certain window for the find-window Action. But what if I want to switch between ALL open Windows? Maybe I left the explorer open on my PC and want to close it via remote?

thanks in advance
User
Posts: 47
Joined: Sun May 11, 2008 12:56 pm

Problem Solved!

Post by User »

Hello!

I have solved the Problem by reading the code of SendKeys.py. It's all in there - sorry to have bothered you.

For everyone who wants to hold a key down, or toggle a key state via eventghost - it's quite simple with a little python-script:

Code: Select all

sendInputStruct = eg.WinApi.Dynamic.INPUT()
sendInputStruct.type = eg.WinApi.Dynamic.INPUT_KEYBOARD
sendInputStructPointer = eg.WinApi.Dynamic.pointer(sendInputStruct)
sendInputStructSize = eg.WinApi.Dynamic.sizeof(sendInputStruct)
keyboardStruct = sendInputStruct.ki

keyboardStruct.dwFlags = 0
# Uncomment this line to release a key:
# keyboardStruct.dwFlags = eg.WinApi.Dynamic.KEYEVENTF_KEYUP

# Get the Key-Code from SendKeys.py
keyboardStruct.wVk = 91
eg.WinApi.Dynamic.SendInput(1, sendInputStructPointer, sendInputStructSize)
Just copy this code into a new Python-Script-Command. dwFlags = 0 presses the Key down and holds it. You can then use another Macro with the same code and uncomment the line below, so the key will be released by that script. The key will also be released by a normal SendKeys-Command from Event-ghost.

My Config now looks like this:

Code: Select all

<Macro Name="Start Application Switch" Expanded="True">
            <Event Name="X10.ChannelUp" />
            <Action Name="Python Script: Windows-Key down">
                EventGhost.PythonScript(u'sendInputStruct = eg.WinApi.Dynamic.INPUT()\nsendInputStruct.type = eg.WinApi.Dynamic.INPUT_KEYBOARD\nsendInputStructPointer = eg.WinApi.Dynamic.pointer(sendInputStruct)\nsendInputStructSize = eg.WinApi.Dynamic.sizeof(sendInputStruct)\nkeyboardStruct = sendInputStruct.ki\n\nkeyboardStruct.dwFlags = 0\n# Uncomment this line to release a key:\n# keyboardStruct.dwFlags = eg.WinApi.Dynamic.KEYEVENTF_KEYUP\n\n# Get the Key-Code from SendKeys.py\nkeyboardStruct.wVk = 91\neg.WinApi.Dynamic.SendInput(1, sendInputStructPointer, sendInputStructSize)\n')
            </Action>
            <Action>
                Window.SendKeys(u'{Tabulator}', False)
            </Action>
        </Macro>
        <Macro Name="Stop Application Switch" Expanded="True">
            <Event Name="X10.ChannelDown" />
            <Action>
                Window.SendKeys(u'{LWin}', False)
            </Action>
        </Macro>
VersHandel
Posts: 1
Joined: Fri Aug 06, 2010 6:45 pm

Re: Task Switching in Windows ???

Post by VersHandel »

What worked for me (a beginner):
Assign a key tbe the task switcher.
Create a "Switch task" macro.
Have the assigned key as the trigger.
Add action Windows->Emulate keystrokes : {Ctrl+Escape}{Tabulator}{Tabulator}

using:
Windows XP
EventGhost 0.3.7.r1462
MCE compatible remote of an ASRock HTPC

Does:
{Ctrl+Escape} activates Windows start button
{Tabulator} moves to Quick Launch bar.
{Tabulator} moves to first active task in task bar

From there you can:
use left/rigth arrow to select the task you want
press return (OK) to activate it.
User avatar
Neytrino
Posts: 3
Joined: Mon Jul 19, 2010 12:41 pm

Re: Task Switching in Windows ???

Post by Neytrino »

If your Windows is 7 or Vista (with "Aero" support), you can use Flip3D to switch tasks...

Image

System/Start application
Executable: C:\Windows\system32\rundll32.exe
Command line options: DwmApi #105
Post Reply