Giter Club home page Giter Club logo

click-tricks's Introduction

Emulate mouse events with macOS

With caffeinate

  1. Open a new Terminal window
  2. Type caffeinate -u -t 3600
  3. Hit enter

This will emulate user activity on the computer for 1 hour (3600 seconds). To cancel the process, just hit ctrl+c. However, caffeinate is intended to prevent your Mac from going to sleep, so it might not register with whatever software your company is using to monitor activity. In that case....

With cliclick

First, you need to get Homebrew, a package manager for macOS. Basically Homebrew lets you install packages from the command line and takes care of software dependencies, installation locations and package updates.

Installing Homebrew

  1. Open a new Terminal window
  2. Paste the following line: /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  3. Hit enter

Installing cliclick

Once you have Homebrew installed, run the following command: brew install cliclick

You'll see a bunch of output as Homebrew installs the package.

Running cliclick

Once Homebrew has done its thing, type the following into your Terminal the following (hit Enter after each line):

for i in {0..3600}
do
cliclick -w 1000 c:100,500
done

This will emulate a mouse click every second at the (100, 500) coordinate on your screen.

Clicking in a pattern

If you want to get fancy, you can also do something like this:

for i in {0..1200}
do
cliclick -w 3000 c:$i, $i
done

The above script will click in a diagonal line across your screen, with 3 seconds in between each click.

Emulating keypresses

for i in {0..3600}
do
cliclick -w 1000 t:H
sleep 5
cliclick key:delete
done

The above script will wait 1 second, type an "H", wait 5 seconds, delete the H, wait 1 second, and then repeat the process.

More possibilities

See the full list of cliclick options.

References:

Homebrew
caffeinate
cliclick
Bash scripting

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.