Linux key press utility

Hello,

I am looking for a Linux equivalent for this Windows utility:
Key Presser

Basically, I need a program that allows me to choose a key on a keyboard, and then the program automatically simulates a key press of that key and inserts it into another running application of my choosing.

Does anyone know of a program, or an alternative way that I can accomplish this?

Thanks

while i’ve never used ‘Key Presser’ or anything similar, i do know
some places to begin your search (while waiting for the person who
does know your answer to waltz through here):

http://linuxappfinder.com/
http://jjmacey.net/blog/?p=179
http://www.osalt.com/
http://www.linuxrsp.ru/win-lin-soft/table-eng.html
http://sourceforge.net/
http://www.google.com/linux

hmmmm…i guess any number of scrip writers could hack up
something…you might (if the above and this thread are fruitless)
post anew to http://forums.opensuse.org/programming-scripting/

and, if you don’t mind can you enlighten me: how might someone use a
program like that…and why? (maybe i know your answer, but don’t yet
understand your need)


palladium

Thanks for the plethora of links; they’ll be a big help in my search.

As to why I need this program, it isn’t actually for me, but my girlfriend. I finally convinced her to let me put Linux on her laptop again (long story), but she demanded I copy every bit of functionality she has in Windows. This includes this key presser utility. She plays the game Secondlife a lot, and she uses the key presser utility to automatically press certain key combinations in the game, whilst she is away doing something else.

I thought about writing her a script that would do it, but unfortunately a program like this far exceeds my script writing abilities. As you say, if my search here is unfruitful, I may be requesting assistance in the programming forum. I’ve also considered seeing if the Windows program will run in Wine.

Thanks again for the links. They’ll keep me busy for awhile. :slight_smile:

On Tue, 2010-02-02 at 16:16 +0000, srschifano wrote:
…snippity…
> I finally convinced her to let me put Linux on her laptop
> again (long story), but she demanded I copy every bit of functionality
> she has in Windows.

Sigh (just fyi)… what your girlfriend is asking for is technically
impossible. Likewise, I would never try to require Windows to do
everything that a Linux distro can do (also impossible).

Hope you can find enough to make her happy… but she’s got
the WRONG motives right now. Moving to a different OS is simply
that… moving to a different OS.

Keep us posted on the progress (her satisfaction).

Technically it is possible to inject X events into the server input, have a look at this page, maybe you can find more links from it:

Hell Labs » Improved X11 keystroke injection

It is also possible to inject keystrokes into CLI sessions using special ioctl calls.

Believe me, I’m well aware of this. She used to run Linux (her laptop came with it) but she got bit by the Intel graphics bug in 08-09 and it left a bad taste in her mouth. I’ve been trying to get her back onto Linux b/c her laptop was designed for it and overall it runs heaps better than Vista (even graphics performance is improved thanks to the changes that initially broke everything.) I’ve been trying to convince her that demanding everything apples-for-apples is a little unreasonable, but it is her laptop after all.

After I got everything else set up, she did comment that things are faster and prettier (I customized the plasma shell extensively). And so far, she can do everything in openSUSE she can in Windows, save for the Key presser. Unfortunately the Windows utility won’t work with Wine (didn’t expect it too) but I did make some progress in finding info to write a script.

@ken_yap - thanks for the link. On a brief read-through it looks very interesting. I’ll keep y’all posted.

Thanks again!:slight_smile:

On Tue, 2010-02-02 at 01:46 +0000, srschifano wrote:
> Hello,
>
> I am looking for a Linux equivalent for this Windows utility:
> ‘Key Presser’
> (http://www.my-spot.info/burton/programs/keypresser.html)
>
> Basically, I need a program that allows me to choose a key on a
> keyboard, and then the program automatically simulates a key press of
> that key and inserts it into another running application of my
> choosing.
>
> Does anyone know of a program, or an alternative way that I can
> accomplish this?

About 4 years ago I wrote something using xsendkey to push
a keypress out to a running Firefox. You could use KDE’s
key shortcuts to invoke xsendkey. The problem is identifying
the window for xsendkey. I’m sure there’s a dbus/dcop call
that could get that somehow roughly by name.

Success! Thanks to the information everyone posted in this thread, I was able to locate a command-line utility that would do everything I need! Thank you everyone! :slight_smile:

The utility I found is called xdotool. It uses xsendkey and xtest to send fake key presses to X windows using a variety of criteria. The utility is highly configurable, and can even control mouse movements, window actions, and window focus.

With xdotool, I was able to write a very simple shell script that copies most of the basic functions the Windows KeyPresser utility has. There are still a few areas I am looking to improve upon with my script, but for the time being my girlfriend is very happy.

From what she tells me, the Windows utility actually has a lot of problems identifying which application to send the input actions too, and a lot of times she can’t do much else on her laptop while it is running. In this regard, my script (though slightly more primitive) is more reliable.

So again, thank you to everyone! Hopefully this time around, she’ll stick with Linux.

Great, I can use this to simulate postings to this forum and do something else in the meantime. Just kidding. lol!

Seriously, glad you found a solution. Hope it improves your valentine points with her. Thanks for reporting back. That information may be useful later on.

LOL@ken_yap

Impressive little tool, I see on the build service the had an older
version, so added the latest release to my miscellaneous repository.
It’s built, just not dispatched…


Cheers Malcolm °¿° (Linux Counter #276890)
SUSE Linux Enterprise Desktop 11 (x86_64) Kernel 2.6.27.42-0.1-default
up 4 days 18:57, 4 users, load average: 0.30, 0.26, 0.22
GPU GeForce 8600 GTS Silent - CUDA Driver Version: 190.53

thanks malcolmlewis… your package came in handy in making another workaround i was using much easier and elegant… thumbs up for me.