Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux installed xdotool simulate keystrokes and mouse movements     - Ubuntu 15.04 Linux install anti-virus software Antiviral 0.2 (Linux)

- Using RAID in Linux: Create a RAID 5 (Linux)

- CoreOS Linux introduces Kubernetes kubelet (Server)

- Red Flag Linux Desktop 6.0 hard disk installation guide (Programming)

- The most commonly used Linux commands (Linux)

- Swift acquaintance of values and references, the circular reference, Agent Precautions (Programming)

- Network security system (Network)

- OpenSSL for secure transmission and use of skills of files between Windows and Linux (Linux)

- Linux System Getting Started Learning: The Linux command line burn ISO or NRG image to DVD (Linux)

- How to Install Suricata IDS on a Linux system (Server)

- FreeBSD install Gnome 3 Desktop (Linux)

- Java programmers talk about those advanced knowledge and direction (Programming)

- Via Twitter how open source library to be used anywhere Emoji emoticons (Linux)

- Use value type build better applications Swift (Programming)

- MySQL database under Linux to achieve automatic backup scheduled backup day (Database)

- Ubuntu and derivative users to install the system launcher SimDock 1.3 (Linux)

- Installation Mate Desktop in FreeBSD 10.1 (Linux)

- Getting the Linux shell variable test (Programming)

- Cobbler automatic mass deployment of CentOS 6 and CentOS 7 (Linux)

- Shorewall firewall settings under Ubuntu (Linux)

 
         
  Linux installed xdotool simulate keystrokes and mouse movements
     
  Add Date : 2018-11-21      
         
         
         
  Let Xdotool settled in Linux

For Ubuntu, Debian or Linux Mint, you can only:

$ Sudo apt-get install xdotool
For Fedora, use the yum command:

$ Sudo yum install xdotool
For CentOS users, can be found in the package in EPEL repo. After you enable the EPEL repository, just use the above command yum can reach your desire.

For Arch users, this package can be found in the Community Warehouse:

$ Sudo pacman -S xdotool
If you still can not find your release corresponds xdotool, you can download it from the official site.

Xdotool basic skills

Although xdotool is so intuitive, but it is still a script. Therefore, in order to use it properly, you still have to know its syntax. Rest assured that, with respect to the functions of the program, the syntax is quite easy to learn.

First of all, it is easy to simulate keystrokes. You can type the following command from a terminal:

$ Xdotool key [name of the key]
If you want to connect two keys, you can use the "+" operator between them. It looks like this:

$ Xdotool key alt + Tab
These two key combination you can switch between windows.

To get xdotool help you input, you can use the following command:

$ Xdotool type ''
For the purposes of these basic keystrokes enough. However, one of the many strengths of xdotool is that it can get the focus of a specific window. It can get the right window, and then enter inside, all your record buttons are not disappeared, but honestly as you wish be there. To obtain this feature, you can get a simple command:

$ Xdotool search --name [name of the window] key [keys to press]
This command searches the open window corresponding to the name of the window, and focus on the window, and then simulate keystrokes.

To something more advanced, but very useful Oh, xdotool can simulate mouse movements and clicks, look at this command:

$ Xdotool mousemove x y
You can position the cursor to the screen coordinates (x, y) (pixel). You can also use the "click" parameter combinations:

$ Xdotool mousemove x y click 1
This will move the mouse to the (x, y), then click on the left mouse button. "1" represents the left mouse button, "2" is the wheel, "3" is right.

Finally, once you have these commands are rooted in your mind, you might want to edit the actual dump file and try to play. In view of this, there will be more than one statement content. All you need is to write a bash script:

#! / Bin / bash
xdotool [command 1]
xdotool [command 2]
etc
Or you can use:

$ Xdotool [filename]
Here you will command written to a separate file, then the file name as an argument xdotool command.

Windfall

As a bonus this article, here is a specific example of xdotool. You may have heard, or may not have heard Bing - Microsoft's search engine. In the example that follows, you will see that you may have never heard of Bing Rewards: a program that allows you to use Bing integration redeemed Amazon gift card and some other gift cards (LCTT Annotation: I've never heard of too ~). To earn these points, you can search on Bing every day totaled 30 times, each time searching you will get 0.5 points. In other words, you have to Bing as the default search engine, and use it every day.

Alternatively, you can use xdotool script, this script will automatically focus to Firefox (you can replace it with your favorite browser) and use the command to generate a fortune to implement some random word search. Within about 30 seconds, your daily search task is complete.

#! / Bin / bash
for i in {1..30}
do
WID = `xdotool search --title" Mozilla Firefox "| head -1`
xdotool windowfocus $ WID
xdotool key ctrl + l
xdotool key Tab
SENTENCE = "$ (fortune | cut -d '' -f1-3 | head -1)"
xdotool type $ SENTENCE
xdotool key "Return"
sleep 4
done
Next to a summary of it: I really like xdotool, even if it's full functionality beyond the scope of this article to cover. This scripting and task automation, it really is a kind of easy way. The negative is that it may not be the most efficient one. But I have to say it again, it devotion to duty, and it is not so much trouble learning it.

Xdotool how you see it? Do you prefer another automated tool rather than do it? why? Tell us in the comments.

How to set up EPEL repository on CentOS

If you are using CentOS or RHEL, it is strongly recommended that you configure EPEL (Extra Packages for Enterprise Linux) repository on your system. EPEL is a community effort to create a repository of high-quality add-on free software packages for RHEL- based distributions. Once you set up EPEL repository, you can use yum command to install any of close to 7,000 EPEL packages.

In order to enable EPEL repository on your CentOS system, you need to check CentOS version. To do that, run the following command.

$ Cat / etc / RedHat-release
CentOS release 6.3 (Final)
Then install an EPEL repository rpm file as follows. Note that the rpm file does not depend on the underlying processor architecture (eg, 32-bit / 64-bit x86, ppc, sparc, alpha, etc), so no need to pay attention to processor architecture difference.

For CentOS / RHEL 5. *:

$ Sudo rpm -Uvh http://mirrors.kernel.org/Fedora-epel/5/i386/epel-release-5-4.noarch.rpm
For CentOS / RHEL 6. *:

$ Sudo rpm -Uvh http://mirrors.kernel.org/fedora-epel/6/i386/epel-release-6-8.noarch.rpm
For CentOS / RHEL 7:

$ Sudo rpm -Uvh http://dl.fedoraproject.org/pub/epel/beta/7/x86_64/epel-release-7-0.2.noarch.rpm
To verify that EPEL repository has been set up successfully, run the following command to list all available repositories on your system.

$ Yum repolist
repo id repo name status
base CentOS-6 - Base 4,776
epel Extra Packages for Enterprise Linux 6 - i386 6,913
extras CentOS-6 - Extras 17
updates CentOS-6 - Updates 960
repolist: 12,666
     
         
         
         
  More:      
 
- Linux systems dmesg command processing failures and system information collected seven usage (Linux)
- Java NIO2: Buffer (Programming)
- Android shutdown (reboot) process (Programming)
- To install the Contiki development toolchain on Ubuntu (Linux)
- xCAT install and update software (Linux)
- Binary search is really easy as you think you do (Programming)
- Close Pycharm spell check (Programming)
- CentOS 6.6 permanent method to modify the DNS address (Linux)
- How to install Linux Go Language (Linux)
- Memcached installation, configuration and monitoring (Server)
- Upgrading from Fedora 20 to 21 (Linux)
- Android WebView use layman (Programming)
- Linux System Getting Started Learning: rename multiple files in Linux (Linux)
- Text editing and viewing text Linux command (Linux)
- Oracle 11g RAC automatically play GI PSU patch (11.2.0.4.8) (Database)
- Atlassian Linux Shell Scripting the confluence remote backup methods (Linux)
- Qt shared memory interprocess communication (Programming)
- Git common skills (Linux)
- Android Studio simple setup (Linux)
- Experience CoreCLR stack unwinding characteristics of initial implementation on Linux / Mac (Linux)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.