473,395 Members | 1,537 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How do you simulate the use of the keyboard ?

In my script, I would like to simulate the fact that someone presses on the "x" key on the keyboard and then presses Return.
I got some info from web, but still confused
Expand|Select|Wrap|Line Numbers
  1. #!/usr/bin/perl -w
  2. require 'sys/ioctl.ph';
  3. die "no TIOCSTI" unless defined &TIOCSTI;
  4. sub jam {    
  5. local $SIG{TTOU} = "IGNORE"; # "Stopped for tty output"    local *TTY;  # make local filehandle    open(TTY, ">/dev/tty")                 or die "no tty: $!";    for (split(//, $_[0])) {        ioctl(TTY, &TIOCSTI, $_)            or die "bad TIOCSTI: $!";    }    
  6. close(TTY);}
  7. jam("@ARGV\n");

If anyone knows how to do that or if it is even possible to do it. Cheers !
Sep 17 '10 #1
0 1391

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Michael J Whitmore | last post by:
Greetings, I have a very simple question. How do you simulate a user input to turn off a screen saver in Windows (either a mouse movement, mouse click, or keyboard input)? I promise I searched...
1
by: Keeper | last post by:
Hi all, I'm trying to send chars to the current console (currently having cursor focus) - /dev/tty0 - in my program by: my $st = 'K' my $ri = 'L' my $ng = 'J' open(TTY, ">/dev/tty0");...
2
by: Keeper | last post by:
Hi all, I'm trying to send chars to the current console (currently having cursor focus) - /dev/tty0 - in my program by: char st='K',ri='L',ng='J'; int tty; tty = open(">/dev/tty0",...
9
by: Marek Mand | last post by:
How to use generated keyboard events? What I am trying here to do is in onkeyup event handler http://www.hot.ee/idaliiga/braggart/createEventTest.htm generate a (shift)TAB keydown so the...
3
by: jimif_fr | last post by:
How is it possible to simulate the keyboard entries (and the mouse events) of one program, from another program. The first program is not written for this purpose and is a not aware of the...
7
by: hokiegal99 | last post by:
I am a relative c newbie, so bare with me. I need to write a program that writes all keyboard keystrokes into a text file (up to 500KB at which point it would begin overwriting itself)...
4
by: gl | last post by:
How can I make C# type to a screen? For instance make a common sentence or closing type into word by hitting a button (essentially a keyboard macro). Also timing has to be considered...for instance...
0
by: Mythran | last post by:
I'm trying to create a library that will 1.) Simulate an input device (IE: keyboard, mouse, joystick) and 2.) Capture data sent from an input device (IE: keyboard, mouse, joystick). The reason's...
4
by: Melson | last post by:
Hi Can anyone help. I would like to replace the keys on the PC keyboard. For example, when I press Q button it displays A on the screen in any programs (MS Words, Note, Lotus....). And also when...
1
by: mnejkova | last post by:
Please tell me how to simulate keyboard (writing in keyboard buffer used by BIOS)?
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.