Re: "SendKeys" equivalent in Linux
From: Dances With Crows (danSPANceswitTRAPhcrows_at_gmail.com)
Date: 07/25/05
- Next message: freddie: "3 systems new user advice needed"
- Previous message: 7: "Re: It must suck to be a microshaft payee"
- In reply to: Wolfgang Draxinger: "Re: "SendKeys" equivalent in Linux"
- Next in thread: Jeremiah DeWitt Weiner: "Re: "SendKeys" equivalent in Linux"
- Reply: Jeremiah DeWitt Weiner: "Re: "SendKeys" equivalent in Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Sun, 24 Jul 2005 19:52:25 -0500
On Mon, 25 Jul 2005 02:10:07 +0200, Wolfgang Draxinger staggered into
the Black Sun and said:
> Tony Lawrence wrote:
>> EKurtz99@aol.com wrote:
>>> In Windows it is possible to control one application from another by
>>> sending keystrokes to the buffer for that app. The technique is
>>> limited, of course, by what you can do via the keyboard in the
>>> driven app. Is there an equivalent in Linux?
>> Several. One is just to use an input file: yourapp <
>> yourfileofkeystrokes
> That's limited to console programs.
Aye.
> In X11 it's quite easy possible to send virtual keystrokes. However I
> never did it so far and it's been quite a while since I've browsed the
> Xlib reference. But the Xlib has definitely functions you want.
You don't need to mess around at that low of a level. There's a program
called "xmacroplay" that can send fake keystroke and mouse events to the
X server. http://xmacro.sourceforge.net/ , the syntax for sending stuff
is a little verbose but easily understandable.
The main problem with xmacroplay is that it sends key events to the
entire X server, not an arbitrary window. Events sent to the entire X
server are usually sent to the currently active window (if they're
normal keys, or mouse events in the currently active window) or the
window manager (if they're special key combinations or mouse events
outside the currently active window) or X itself (Ctrl-Alt-F?,
Ctrl-Alt-+/- , Ctrl-Alt-Bkspace).
It'd certainly be possible to use xmacroplay to send "Alt+Tab" to the
window manager until the proper window was active, but that'd require a
bit of communication that I don't know if X provides. So: Is it
possible to query X in some way and find the title of the currently
active window? Something with "xwininfo | grep $TITLE" , maybe?
-- Matt G|There is no Darkness in Eternity/But only Light too dim for us to see Brainbench MVP for Linux Admin / mail: TRAP + SPAN don't belong http://www.brainbench.com / -----------------------------/ This space sort of for rent.
- Next message: freddie: "3 systems new user advice needed"
- Previous message: 7: "Re: It must suck to be a microshaft payee"
- In reply to: Wolfgang Draxinger: "Re: "SendKeys" equivalent in Linux"
- Next in thread: Jeremiah DeWitt Weiner: "Re: "SendKeys" equivalent in Linux"
- Reply: Jeremiah DeWitt Weiner: "Re: "SendKeys" equivalent in Linux"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|