Auto Key press fill forms through simulating key presses | Linux.com
This script can be used to repeatedly press <a class="zem_slink" title="Electronic keyboard" rel="wikipedia" href="http://en.wikipedia.org/wiki/Electronic_keyboard">keys on the <a class="zem_slink" title="Keyboard (computing)" rel="wikipedia" href="http://en.wikipedia.org/wiki/Keyboard_%28computing%29">keyboard, it was used to fill out 100 odd entries on a <a class="zem_slink" title="Web page" rel="wikipedia" href="http://en.wikipedia.org/wiki/Web_page">web page while testing without having to physically enter the data.
Save the code below some where like <a class="zem_slink" title="Filesystem Hierarchy Standard" rel="wikipedia" href="http://en.wikipedia.org/wiki/Filesystem_Hierarchy_Standard">/usr/bin/ with what ever file name you like, set the file to be <a class="zem_slink" title="Executable" rel="wikipedia" href="http://en.wikipedia.org/wiki/Executable">executable with <a class="zem_slink" title="Chmod" rel="wikipedia" href="http://en.wikipedia.org/wiki/Chmod">chmod +x /usr/bin/keyrepeat
you can then run the command keyrepeat 100 ”1” or what ever you chose as the <a class="zem_slink" title="Filename" rel="wikipedia" href="http://en.wikipedia.org/wiki/Filename">filename of your script.
You will have 5 seconds to focus a window, the program will then simulate a user pressing the keys on the keyboard.
sleep 5 #delay to allow the user to focus a window number=$1 #first parameter, number of times to repeat text=$2 #second parameter, text to repeat will interpret as tab for ((counter=1;counter< =$number;counter+=1)); do #loop required number of times xvkbd -xsendevent -text $text #this sends the text as key presses done
<a href="http://www.linux.com/community/blogs/auto-key-press-fill-forms-through-simulating-key-presses.html">http://www.linux.com/community/blogs/auto-key-press-fill-forms-through-simulating-key-presses.html<h6 class="zemanta-related-title" style="font-size: 1em;">Related articles by Zemanta <ul class="zemanta-article-ul"> <li class="zemanta-article-ul-li"><a href="http://linux.byexamples.com/archives/407/google-search-in-command-line/">Google search in command line ” Linux by Examples (linux.byexamples.com) <li class="zemanta-article-ul-li"><a href="http://maketecheasier.com/qjoypad-keyboard-to-gamepad-mapping-for-linux/2010/05/03">Qjoypad: Keyboard to Gamepad Mapping for Linux (maketecheasier.com) <li class="zemanta-article-ul-li"><a href="http://www.linuxjournal.com/article/3769">Emacs Macros and the Power-Macros Package | Linux Journal (linuxjournal.com) <div class="zemanta-pixie" style="margin-top: 10px; height: 15px;"><a class="zemanta-pixie-a" title="Enhanced by Zemanta" href="http://www.zemanta.com/"><img class="zemanta-pixie-img" style="border: medium none; float: right;" src="http://blog.amit-agarwal.co.in/wp-content/uploads/2010/08/zemified_e10.png" alt="Enhanced by Zemanta" /><span class="zem-script more-related pretty-attribution">
Related Articles:
- 2010/05/19 Mirror or download a website with a tool much better than wget
- 2010/07/11 gnomecc color scheme - my favourite.
- 2010/07/25 importing outlook pst files in evolution in Fedora 13 ( Goddard)
- 2010/07/20 Linux command to repeat a string n times - Super User
- 2010/07/14 A Five-Way Linux Distribution Comparison In 2010