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.

Problem with sending Keystrokes to a swing background window

If you have a question or need help, this is the place to be.
Post Reply
azrael
Posts: 2
Joined: Mon Feb 22, 2010 12:53 pm

Problem with sending Keystrokes to a swing background window

Post by azrael »

Hi there,
i am having problems with sending a X keystroke to a java swing window that shall remain in the background.
What i did was the following:

Code: Select all

<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1194">
    <Macro Name="Finde Fenster: javaw.exe" Expanded="True">
        <Action>
            Window.FindWindow(u'javaw.exe', u'MASP Notification with feedback', u'SunAwtFrame', None, None, None, False, 0.0, 0)
        </Action>
        <Action>
            Window.SendKeys(u'x', False)
        </Action>
    </Macro>
</EventGhost>
The window is found, if i move it or do something else, it works, but sending the keys doesn't.
Now, if i add

Code: Select all

    <Action>
        Window.BringToFront()
    </Action>
before the sendKeys, it works. But the thing is i'd like to keep the window in the background, keeping it invisible from the user. If i test the same thing with notepad, it works. But the java swing application wil only handle the keystrokes if it is in the foreground/focused.

Is there a fix available for this apart from not automating java swing applications at all? Maybe to use the mouse to click a button while the window is in the background (didnt manage to do that)?

Regards,

Paul
Post Reply