LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 07-19-2005, 02:56 AM   #1
htlin
LQ Newbie
 
Registered: Jun 2005
Posts: 5

Rep: Reputation: 0
How to simulate keypress in Linux?


Hi All,

I would like to know the way of how to simulate keypresses in Linux.

Function "keybd_event" can be used to achieve this in Windows.
I am wondering if there's similar function in Linux so that I can use to achieve my purpose.

Thank you in advance for your response!
 
Old 07-19-2005, 09:30 AM   #2
dazdaz
Member
 
Registered: Aug 2003
Location: Europe
Distribution: RHEL, CentOS, Ubuntu
Posts: 333

Rep: Reputation: 17
Hi,

Would expect suit your purposes ? There is an O'Reilly book on it. It ain't perfect, but it gets the job done.

Expect homepage
http://expect.nist.gov/

Latest Expect source
ftp://ftp.nist.gov/mel/div826/subject/expect/

Expect scripts
http://expect.nist.gov/scripts/

Expect FAQ
http://expect.nist.gov/FAQ.html
 
Old 07-19-2005, 10:18 AM   #3
keefaz
LQ Guru
 
Registered: Mar 2004
Distribution: Slackware
Posts: 6,552

Rep: Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872Reputation: 872
There is XTestFakeKeyEvent() function from Xlib
 
Old 07-19-2005, 10:22 AM   #4
scuzzman
Senior Member
 
Registered: May 2004
Location: Hilliard, Ohio, USA
Distribution: Slackware, Kubuntu
Posts: 1,851

Rep: Reputation: 47
If this is for a shell script, you'd want "expect" as noted above.
For GTK-based programs use this link.
For Qt-based programs this link might be useful.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
catching a keypress on X MD3 Programming 0 02-14-2005 02:07 PM
Simulate a CDROM fiod Linux - General 4 02-12-2005 07:47 PM
emulating a keypress burglus Programming 2 01-29-2005 05:45 AM
Firefox crashing on keypress usercsr Slackware 4 08-24-2004 05:50 PM
sEND a kEYPRESS tO XFree86? nibjb Linux - Software 3 01-12-2004 03:38 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:54 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration