Automating Mouse Clicks and Key Presses

in #technology7 years ago

I work on a lot of interactive art installation production events using custom software and hardware setups temporary and permanent. It's essential to be able to automate certain processes in case the installation needs to be up and running 24/7 or you don't have some kind of remote access to your computer setup, or better yet be able to physically be on site to set things up properly.

Using a handy command-line application called Cliclick you can automate keypresses and clicks. This is a useful tool for permanent interactive installations. For example, you could use it to click off dialog boxes on startup, or click on specific windows that need to be brought to the front most application, etc. Here is a quick demo to get started.

  1. For Mac users you'll need to install Homebrew.
  2. After you have installed this tool you can quickly and easily download and install other handy command-line applications in this case Cliclick.
  3. Open up Terminal, type the following brew install cliclick
  4. You should be able to run the command cliclick -h and you'll be given a list of all the commands you can use with this application.
  5. Now while still in terminal navigate to an appropriate directory in my case the desktop will do. Run the command touch myNewCliclickApp
  6. Run the command chmod u+x myNewClickApp to make that file you just created an executable.
  7. Open up and text editor in my case Sublime Text and open the file you just created and write the following in that document:

echo "Cliclick is clicking and writing on your page!"

cliclick c:640,320;

cliclick t:"Hello I'm your computer writing by myself in your text editor"

cliclick kp:enter

cliclick t:"Nothing weird about this at all"

and now 'Save'

  1. IMPORTANT NOTE: Before running this script open up a blank 'Sublime Text' text document and maximize it's window. What this script will do when you run it is first click on the center of your page i.e. my screen resolution is 1280 X 640 / 2 = 640 X 320
  2. Now in terminal you can run the command ./myNewCliclickApp and it will run the script you just wrote.
  3. It should work something like this
Sort:  

Interesting!! I guess it is the same process for Linux?

Yup, you would just skip the homebrew installation since that is mac only. If you're using something like Ubuntu you could just download the Cliclick tool right away.

Coin Marketplace

STEEM 0.20
TRX 0.12
JST 0.029
BTC 61440.52
ETH 3447.43
USDT 1.00
SBD 2.52