cliclick - シェルから利用できるmacOS用のマウス・キーボードエミュレーター

S 2017 06 05 10 47 50


OS X 10.6以降で動作し、BSD-3-ClauseでライセンスされたObjective-C製ソースコードがGitHubで公開されています。






brew install cliclick

「cliclick -h」で利用可能なオプションが確認できます。

  cliclick [-m ] [-f ] [-w ] [-r] command1 [command2] [...]

  -r        Restore initial mouse location when finished
  -m  The mode can be either “verbose” (cliclick will print a
            description of each action to stdout just before it is
            performed) or “test” (cliclick will only print the
            description, but not perform the action)
  -f  Instead of passing commands as arguments, you may instead
            specify a file from which cliclick will read the commands
            (or stdin, when - is given as filename).
            Each line in the file is expected to contain a command
            in the same format/syntax as commands given as arguments
            at the shell. Additionally, lines starting with the hash
            character # are regarded as comments, i.e.: ignored. Leading
            and trailing whitespace is ignored, too.
  -w   Wait the given number of milliseconds after each event.
            If you find that you use the “wait” command too often,
            using -w could make things easier. Please note that “wait”
            is not affected by -w. This means that invoking
            “cliclick -w 200 wait:500” will wait for 700 milliseconds.
            The default (and minimum) value for -w is 20.
  -V        Show cliclick version number and release date
  -o        Open version history in a browser
  -d        Send a donation

To use cliclick, you pass an arbitrary number of commands as arguments. A command consists of a command identifier (a string that tells cliclick what kind of action to perform) and usually one or more arguments to the command, which are separated from the command identifier with a colon. Example: “c:123,456” is the command for clicking (the “c” is the command identifier for clicking) at the position with x coordinate 123 and y coordinate 456. See below for a list of all commands and the arguments they expect.
Whenever a command expects a pair of coordinates, you may provide relative values by prefixing the number with “+” or “-”. For example, “m:+50,+0” will move the mouse 50 pixels to the right. Of course, relative and absolute values can be mixed, and negative values are possible, so “c:100,-20” would be perfectly valid. (If you need to specify absolute negative values in case you have a setup with a second display arranged to the left of your main display, prefix the number with “=”, for instance “c:100,=-200”.)


  c:x,y   Will CLICK at the point with the given coordinates.
          Example: “c:12,34” will click at the point with x coordinate
          12 and y coordinate 34. Instead of x and y values, you may
          also use “.”, which means: the current position. Using “.” is
          equivalent to using relative zero values “c:+0,+0”.


もっとも簡単な指定の位置をクリックするコマンドは「cliclick c:10,10」のように実行します。cがマウスクリックを、その後の数字がクリックする座標を表しています。

S 20170605 105710



Drag and drop

すなわち「cliclick dd:30,30 du:100,100」と実行すると、その位置に存在した画像の位置が移動します。



S icon タイトル cliclick
説明 シェルから利用できるmacOS用のマウス・キーボードエミュレーター。