Giter Site home page Giter Site logo

bluem / cliclick Goto Github PK

View Code? Open in Web Editor NEW
1.5K 45.0 115.0 331 KB

macOS CLI tool for emulating mouse and keyboard events

Home Page: https://www.bluem.net

License: Other

Objective-C 88.49% PHP 1.37% Makefile 0.62% Shell 9.52%
objective-c cli macos mouse-events keyboard-events terminal

cliclick's Introduction

cliclick Overview

cliclick (short for “Command Line Interface Click”) is a tool for executing mouse- and keyboard-related actions from the shell/Terminal. It is written in Objective-C and runs on macOS 10.15 or later.

Author: Carsten Blüm, www.bluem.net

Installation

You can either build cliclick yourself (see below), choose a binary from the releases or install it using either Homebrew or MacPorts.

Important: it is necessary to give Terminal (or iTerm or whatever you use) the permission to control the computer. This can be done in System Preferences ➔ Security ➔ Accessibility. If you invoke cliclick and nothing happens, the permission is probably missing. Since cliclick 5.1, in this case a warning will be written to stderr.

Usage

To get a quick first impression, this is what you will get when you invoke cliclick -h:

USAGE
  cliclick [-r] [-m <mode>] [-d <target>] [-e <num>] [-f <file>] [-w <num>] command1 [command2]

OPTIONS
  -r          Restore initial mouse location when finished
  -m <mode>   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)
  -d <target> Specify the target when using the “p” (“print”) command.
              Possible values are: stdout, stderr, clipboard or the path
              to a file (which will be overwritten if it exists).
              By default (if option not given), stdout is used for printing
  -e <easing> Set an easing factor for mouse movements. The higher this
              value is (default: 0), the more will mouse movements seem
              “natural” or “human-like”, which also implies: will be slower.
              If this option is used, the actual speed will also depend
              on the distance between the start and the end position, i.e.
              the time needed for moving will be higher if the distance
              is larger.
  -f <file>   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 <num>    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
  -n          Send a donation

COMMANDS
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”.)

LIST OF COMMANDS

  rc:x,y  Will RIGHT-CLICK at the point with the given coordinates.
          Example: “rc:12,34” will right-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”.

  m:x,y   Will MOVE the mouse to the point with the given coordinates.
          Example: “m:12,34” will move the mouse to the point with
          x coordinate 12 and y coordinate 34.

  kd:keys Will trigger a KEY DOWN event for a comma-separated list of
          modifier keys. Possible keys are:
            - alt
            - cmd
            - ctrl
            - fn
            - shift
          Example: “kd:cmd,alt” will press the command key and the
          option key (and will keep them down until you release them
          with another command)

  kp:key  Will emulate PRESSING A KEY (key down + key up). Possible keys are:
            - arrow-down
            - arrow-left
            - arrow-right
            - arrow-up
            - brightness-down
            - brightness-up
            - delete
            - end
            - enter
            - esc
            - f1
            - f2
            - f3
            - f4
            - f5
            - f6
            - f7
            - f8
            - f9
            - f10
            - f11
            - f12
            - f13
            - f14
            - f15
            - f16
            - fwd-delete
            - home
            - keys-light-down
            - keys-light-toggle
            - keys-light-up
            - mute
            - num-0
            - num-1
            - num-2
            - num-3
            - num-4
            - num-5
            - num-6
            - num-7
            - num-8
            - num-9
            - num-clear
            - num-divide
            - num-enter
            - num-equals
            - num-minus
            - num-multiply
            - num-plus
            - page-down
            - page-up
            - play-next
            - play-pause
            - play-previous
            - return
            - space
            - tab
            - volume-down
            - volume-up
          Example: “kp:return” will hit the return key.

  tc:x,y  Will TRIPLE-CLICK at the point with the given coordinates.
          Example: “tc:12,34” will triple-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.
          Note: If you find that this does not work in a target application,
          please try if double-clicking plus single-clicking does.

  ku:keys Will trigger a KEY UP event for a comma-separated list of
          modifier keys. Possible keys are:
            - alt
            - cmd
            - ctrl
            - fn
            - shift
          Example: “ku:cmd,ctrl” will release the command key and the
          control key (which will only have an effect if you performed
          a “key down” before)

  dm:x,y  Will continue the DRAG event to the given coordinates.
          Example: “dm:112,134” will drag and continue to the point with x
          coordinate 112 and y coordinate 134.

  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”.

  dd:x,y  Will press down to START A DRAG at the given coordinates.
          Example: “dd:12,34” will press down 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.

  w:ms    Will WAIT/PAUSE for the given number of milliseconds.
          Example: “w:500” will pause command execution for half a second

  p[:str] Will PRINT the given string. If the string is “.”, the current
          MOUSE POSITION is printed. As a convenience, you can skip the
          string completely and just write “p” to get the current position.
          Example: “p:.” or “p” will print the current mouse position
          Example: “p:'Hello world'” will print “Hello world”

  du:x,y  Will release to END A DRAG at the given coordinates.
          Example: “du:112,134” will release at the point with x
          coordinate 112 and y coordinate 134.

  cp:str  Will PRINT THE COLOR value at the given screen location.
          The color value is printed as three decimal 8-bit values,
          representing, in order, red, green, and blue.
          Example: “cp:123,456” might print “127 63 0”

  dc:x,y  Will DOUBLE-CLICK at the point with the given coordinates.
          Example: “dc:12,34” will double-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.

  t:text  Will TYPE the given TEXT into the frontmost application.
          If the text includes space(s), it must be enclosed in quotes.
          Example: “type:Test” will type “Test”
          Example: “type:'Viele Grüße'” will type “Viele Grüße”

Limitations

  • It is not possible to use cliclick before a user logs in, i.e.: to control the login window.
  • In Citrix Viewer, clicks are not recognized. Moving the mouse works, but this seems futile without being able to click.

Building cliclick

Either build in Xcode, as usual, or build from the shell by cding into the project directory and then invoking either xcodebuild or make (whatever you prefer). In either case, cliclick will not be installed, but you will simply get an executable called “cliclick” in the project directory which you can then move wherever you want to have it. (You can put it anywhere you like.) To install it to /usr/local/bin, you can also simply invoke sudo make install, which will do this for you.

Please note that while the code will run on OS X 10.9 and later, Base SDK and architectures selected in the Xcode project are set to the current SDK. Therefore, if you want to build for an older system, be sure to change these settings accordingly. If you have problems when building and get a message complaining about undefined symbols, chances are that this can be fixed by disabling “Implicitly link Objective-C Runtime Support” in the build settings.

Contributing

If you would like to contribute a new feature, a bugfix or other improvement, please do so using a pull request. However, please take care that:

  • There is one pull request per topic. I.e.: if you would like to contribute a new feature and two bugfixes, open three pull requests.
  • All commit messages are in English.
  • Ideally, all non-obvious features or changes should be shortly explained. This might not only include what you committed, but also why you did it (motivation, usage scenario, …).

cliclick's People

Contributors

bluem avatar boonkerz avatar jlmuir avatar muellermartin avatar ryandesign avatar selvakn avatar shuuji3 avatar wfaulk avatar wfaulk-bw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cliclick's Issues

Screenshot shortcut

Hello,

I'm looking for a method to emulate shift + cmd + 3 (screenshot)

I tried this

cliclick kd:shift,cmd kp:num-3

but it doesn't work.

Any help will be very nice

Latest version via brew?

Hi,

Is brew 3.1 already available via brew?
I just wanted to updated to cliclick 3.1 via brew and got this message:

brew upgrade cliclick
Error: cliclick 3.0.3 already installed

Add support for right-clicking

The pure X11 (Linux) equivalent to cliclick, called xdotool, allows the user to specify which mouse button is used when sending a click event.

Add support for relative mouse movements

For example, say I need to move the mouse 50px down. Currently, I must find the current mouse position, then do some math to find the end mouse position. Preferably, we could just send the command m:+0,+50, to indicate a relative move of +0 on x and +50 on y.

Love the utility!

Does not work with Bluestacks

Hi, I'm trying to use this with Bluestacks and it seems that the cursor is moved to the position but it does not stimulate the clicking. I have tried this with c, dc and tc. Is there a fix for this or a workaround that I could use?

Thanks.

Window position does not change while being dragged using the dd/du commands

I am using the start drag and end drag commands invoked as voice commands from Mac Dragon 6 so that I can drag windows and other UI elements around without having to hold the mouse button down. So, for example, I'll say the command "mouse down" (cliclick dd:+0,+0) to start the drag once my mouse is positioned over a window title bar, then I will move the window using my mouse, and then I will say the command "mouse up" (cliclick du:+0,+0) to end the drag.

All of this works, but the problem I'm having is that while the drag is in progress, the window is not being continuously dragged across the screen; only when I end the drag operation does the window position update.

I'm seeing the same behavior when using this technique to drag objects within a drawing program like Sketch. Scrollbars in the Chrome browser do actively update during the drag, although scrollbars in the Finder do not.

Any ideas why the Mac would not update the position of an element while it is being dragged using these commands?

Thanks!
-rem

absolute negative values (“c:100,=-200”) aren't accepted

The help says to prefix with = to specify absolute positions on displays left of (/above) the main display:

(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”.)

However this isn't working for me:

$ ./cliclick p
Current mouse position: -1039,-1328
$ ./cliclick c:=-1039,=-1328
Invalid X axis coordinate “=-1039” given

If I try that without the = I get a click at a relative position (as expected).

Perhaps I misunderstood the format?

Key press does not work on russian keyboard on OS X 10.12.6

I'm using cliclick to test hotkeys in my app. For example it presses control+shift+v. And the test runs on english and russian keyboards. But now then i run it on mac with 10.12.6 on board I get only control+shift when i switch to russian. Button "V" is ignored. It worked in earlier versions of OS X.

Click through AppleScript is not opening menu of system bar

If I do a click through AppleScript on the system bar (where the clock, the battery, the wifi etc. are, in german "Menüleiste") nothing happens. My code (with AS):
do shell script "/opt/local/bin/cliclick c:810,10"
Not possible to emulate a click there. The mouse jumps to the position (810,10) but doesn't click.
With direct command on Terminal it is no problem.

Is there a trick or is it just forbidden by the system to use cliclick through AS?

On Mac OS 10.11.6 with cliclick (vs3.3, 11/12/2016) on my MacBook Pro Mid 2009

Thank

frank

How can reach this app from python?

Im not that good at coding and now really just a bit. I got this python script for blender which copies the mouse movent in blender to something in Marvelouse Designer. Now this code was written for windows, which can use:

ctypes.windll.user32.mouse_event(2, 0, 0, 0,0) # left down

is there a easy way to do this with for example Popen orso? But i need to now how to get the path or should i look elsewhere?

How to do cmd-C, cmd-V, cmd-X ...

How can you generate keyboard sequences like Copy, Paste etc. ?
I tried 'cliclick kd:cmd t:v ku:cmd' but that just prints out v instead of triggering a copying event.
If this isn't possible yet, I am happy to add something along the line of:

  • ad:, trigger key down event for key
  • au:, trigger key up event for key

or extend kd, ku to take a key code in addition to the current special keys

Any feedback would be helpful

Compile fails on Mac OS X 10.6

Hello, I'm the maintainer of cliclick in MacPorts and I recently updated our port to 3.0.2. It doesn't build for us on Mac OS X 10.6. We see errors like:

KeycodeInformer.m:48: error: expected ')' before 'instancetype'

and:

Actions/KeyBaseAction.m:36: error: expected expression before '@' token

Curiously, although your web page lists 10.6 or later as a requirement, it builds fine on Mac OS X 10.4.

improved dragging

First: cliclick is awesome! Congrats BlueM

The current dd and du commands work well when you try to drag an object from one place to another in an immediate action. But I could not find a way of having an ongoing dragging action, which is needed when using cliclick as a component in a remote desktop software (a la RDP or VNC)

Examples:

  • a user is dragging a document across the desktop
  • interacting with a 3D Software and rotating/handling objects continuously
  • dragging scrollbar on a window

I could not find a way to do it (possible I just didn't find a existing way), so I took cliclick's code and adjusted actions for dd, du and mm. Happy to share and create a pull request but I couldn't create a separate branch in order to actually create a pull request. BlueM, let me know what I should do, I would love to contribute.

Add support for ku at coordinates

Some web pages/menus only recognize a click after releasing the mouse,,, a key up.

Using cliclick c on a menu does not trigger the web page button. The only way to achieve a click on these menus is to use the cliclick dc option which seems to work. If a ku in combination with coordinates and not other keystrokes could be programmed into the software that would be helpful.

Change donation switch to avoid ambiguity

Problem: user reported that after executing the (invalid) command …
cliclick -dd:261,132
… no doubleclicking was performed, but the donations page (invokable via -d) was opened.

Option -d should be changed to a character which is not identical to the first character of any of the commands.

About drag (again)

Hi,
Unfortunately, from my experience, the drag command does not seem to always return the expected results. I was trying to drag a folder from a Finder's window over a window of "ImageOptim" and repeating the same command over and over, sometimes (a few times) it works perfectly, sometimes (most of the time) it doesn't.
In addition, during these tests nothing else was changed and the "working conditions", at least those under my control, were always the same.

I tried to run all the commands directly from Terminal and all via Applescript, and I tried all the following with little changes of w: (wait amount and/or wait position(s) in the command) or other slight variations:

dd:1010,113 du:1010,650 (via AppleScript and activating Finder's window just before do shell …)
c:1010,113 dd:. du:1010,650 (as suggested having a similar issue)
c:1010,113 dd:1010,113 du:1010,650
open -a Finder; cliclick dd:1010,113 w:300 du:1010,650
c:1010,113 w:300 dd:. du:1010,650

cliclick m:1010,113 w:200 c:. w:200 dd:1010,113 w:200 du:1010,650 (this last one from Terminal, having the ImageOptim's window as last "active" window before focus on Terminal, has worked 4 times continuously … but not the 5th and 6th. Then again the 7th test.

Actually if one of these command works… repeating it again after a while, it doesn't any more. Have you please any further suggestion or advice about this?
And about this topic the dd:x,y du:x,y commands, may also have other commands between them or only the w: command is allowed? Thanks.

Lock USB mouse while simulated events fire

I'm really enjoying this tool - many thanks to the developer. I'm using it to simulate mouse events for a GUI application that lacks fine tuning by keyboard. The issue I'm encountering is that sometimes if I accidentally move the physical mouse while cliclick is executing, the mouse will get stuck in a click until the next cliclick event. Is there any way to disable physical mouse input while cliclick is executing? Thanks!

Mouse moves slow in 4.0b1

Hallo

I just updated to cliclick 4.0b1 from version 3.3 and now I notice that when I do mouse moves the Mouse Cursor doesn't jump anymore, but moves visible from a to b. It moves as if I would use the mouse myself, even slower.
Is this by purpose or intention?
Or is it a setting?
Is it related to my own compiling with XCode and kind of home-made? I set Product > Build For > Running though.

I reverted to 3.3 where it is fast again.

Thanks
frank

Has the -q option been removed?

I have an old applescript that I wrote a couple of years ago that uses the -q option to get the current mouse position. However, in the current version cliclick -q returns an illegal option error.

Support setting base coordinate for subsequent coordinates-based actions

It could be handy to add a command-line option which takes coordinates, example: cliclick -b 500,400.

The idea behind this is that sometimes when defining coordinates to be used by cliclick, all coordinates depend on a certain base value. For example, when performing actions in an application window, the click or move coordinates will frequently be fixed relative to the window, but the window could be anywhere on the screen. In this case it would be great to just get the window bounds using AppleScript (or osascript at the shell) and set the base coordinate to a window corner and specify all distances from that base coordinates. cliclick would then add that base coordinates to all given action coordinates.

As cliclick supports relative coordinates, something similar can be done already using relative values only, but having base coordinates is probably easier to read and write.

Always target latest SDK for building

Currently I'm using macOS 10.12.1 with Xcode 8.1 and if I import the project and initially try to build it I get an error stating The run destination My Mac is not valid for Running the scheme 'cliclick'.
This is caused by the project setting Base SDK located under PROJECT > cliclick > Build Settings > Architectures set to macosx10.7 which for me is showing SDK not found.

I'm not that familiar with Xcode (actually this is the first time I'm contributing to a project using it 😅) therefore this might be no good suggestion, but couldn't it help to set it to always use the latest SDK?

Therefore I'm suggesting this:

diff --git a/cliclick.xcodeproj/project.pbxproj b/cliclick.xcodeproj/project.pbx
index 58db10c..b4b3c4b 100644
--- a/cliclick.xcodeproj/project.pbxproj
+++ b/cliclick.xcodeproj/project.pbxproj
@@ -413,7 +413,7 @@
                ONLY_ACTIVE_ARCH = YES;
                OTHER_CFLAGS = "-DDEBUG=1";
                PREBINDING = NO;
-               SDKROOT = macosx10.7;
+               SDKROOT = macosx;
            };
            name = Debug;
        };
@@ -428,7 +428,7 @@
                MACOSX_DEPLOYMENT_TARGET = 10.7;
                OTHER_CFLAGS = "";
                PREBINDING = NO;
-               SDKROOT = macosx10.7;
+               SDKROOT = macosx;
            };
            name = Release;
        };

Add support for “eject” key

Hallo
on my MacBook Pro from late 2009 (and surely on many other macs) there is the "Eject" Button, this is the very top right key on the keyboard. This is the picture on the key.
There seems no emulation for this button in cliclick.
Is it possible to add it?
Thanks

frank

Sending shortcut

Just have not found how to ask question, so the question is: how to send shortcut into active windows e.g. ALT+CMD+I, to open Google Chrome Development Tools
Thanks

FeatureRequest: Support Mouse Down, Mouse Up - Not "just" Mouse Click

Hi Carsten,

After an upgrade to Sierra I had to realize that Karabiner/Seil are not working anymore, for the following use case:
I could, before the update, bind a key to the left mouse button, e.g. in their config format:

  KeyCode::D, ModifierFlag::OPTION_R | ModifierFlag::NONE,
  PointingButton::LEFT

(and option-r was remapped to caps-lock via seil)

That enabled me to do this:

  1. caps-lock + d -> mouse down (e.g. on start of text to select, e.g. on window border, with left hand)
  2. trackpad move pointer to destination (with right hand)
  3. release d and caps lock

This was amazingly effective, far more precise then clicking on the trackpad and less strain, basically just like tapping - but without having to move the hand away from the default typing position....

With cliclick I can't get it, since you 'just' support a full click but not a seperate mouse down / mouse up and drag did also not really work, e.g.:

#!/usr/bin/env bash
while true; do
    sleep 1
    echo down
    ./cliclick dd:.
    sleep 1
    echo up
    ./cliclick du:.
done

and then moving the pointer over text did not select in the browser and also not move any window when I move over its border while the the script is running.


Note: Tried to mess around a few hours with swift and obj.c - but to no success, could not really emulate a left mouse button down / up only, at the current track pad position.
Only managed to get same behaviour like pressing the '5' key on the numeric keyboard when the MouseEvents feature is on - but that allows not to drag, after 5 is down, dragging works then only with the other numeric keys. Crazy...

Maybe you find it trivial, sort of my last hope,

Cheers from Nr. 400 ;-)

Scrolling would be really great

It'd be heaps nice if there was a way to issue scrolling commands - ideally the smooth scrolling kind, not the chunky click mouse wheel variety. Is this a possibility?

Leads to read value for keyboard backlit

Hi,

I'm writing a slider for backlit intensity for the mbp 2016 touch bar. I'm using your app to set the value up/down but I can't read the value as Apple removed the old ways of doing it.

Do any one have an idea on how to read the keyboard backlit value ?

Absolute negative coordinates are not accepted when clicking

Quote from cliclick’s help:

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”.

Such coordinates are not accepted by cliclick 3.2

Can't compile from source ActionsClassesMacro.h not found

I believe this is due to a new version of the OS and/or XCode.

OS version: 10.12.4
XCode Version: 8.3.2

Here's the build:
sandra@MacBook-Pro-2:~/socrates/snapshots/bin/cliclick-master$ make install
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/ClickAction.o Actions/ClickAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/ColorPickerAction.o Actions/ColorPickerAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/DoubleclickAction.o Actions/DoubleclickAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/DragDownAction.o Actions/DragDownAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/DragUpAction.o Actions/DragUpAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/KeyBaseAction.o Actions/KeyBaseAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/KeyDownAction.o Actions/KeyDownAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/KeyDownUpBaseAction.o Actions/KeyDownUpBaseAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/KeyPressAction.o Actions/KeyPressAction.m
Actions/KeyPressAction.m:136:51: warning: 'NSSystemDefined' is deprecated: first deprecated in macOS 10.12
[-Wdeprecated-declarations]
NSEvent *e1 = [NSEvent otherEventWithType:NSSystemDefined
^~~~~~~~~~~~~~~
NSEventTypeSystemDefined
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:78:26: note:
'NSSystemDefined' has been explicitly marked deprecated here
static const NSEventType NSSystemDefined API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeSystemDefined", macosx(10....
^
Actions/KeyPressAction.m:147:51: warning: 'NSSystemDefined' is deprecated: first deprecated in macOS 10.12
[-Wdeprecated-declarations]
NSEvent *e2 = [NSEvent otherEventWithType:NSSystemDefined
^~~~~~~~~~~~~~~
NSEventTypeSystemDefined
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSEvent.h:78:26: note:
'NSSystemDefined' has been explicitly marked deprecated here
static const NSEventType NSSystemDefined API_DEPRECATED_WITH_REPLACEMENT("NSEventTypeSystemDefined", macosx(10....
^
2 warnings generated.
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/KeyUpAction.o Actions/KeyUpAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/MouseBaseAction.o Actions/MouseBaseAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/MoveAction.o Actions/MoveAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/PrintAction.o Actions/PrintAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/RightClickAction.o Actions/RightClickAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/TripleclickAction.o Actions/TripleclickAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/TypeAction.o Actions/TypeAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o Actions/WaitAction.o Actions/WaitAction.m
cc -include cliclick_Prefix.pch -I Actions -I . -c -o ActionExecutor.o ActionExecutor.m
ActionExecutor.m:30:10: fatal error: 'ActionClassesMacro.h' file not found
#include "ActionClassesMacro.h"
^
1 error generated.
make: *** [ActionExecutor.o] Error 1

Feature Request: Record

Add a --record SECONDS option.

I want to record a set of movements (minimum, just X/Y coordinates) with timings for a set number of seconds.

I have a use case where I need the mouse to follow a specific path, currently, am doing while true; do ./cliclick p >> output.txt; done, and regexing the output.

Unfortunately, there are lots of duplicates during pauses but mostly because I don't know the ms between the pauses or the polling interval since I'm running command-line (re-running the command obviously causes some ms delay, as well as writing to a file). There's no control. I don't know if it's 10ms or 20ms that I've stayed in a certain spot.

A record function could remove duplicate m:x,y positions, and insert in proper w:ms commands.

EDIT: sorry, I derped. ./cliclick actually clicked Close. ;)

Cannot read command file from stdin

When attempting to read commands from stdin, so that I could type them line by line into the terminal, by invoking cliclick as cliclick -w 100 -f /dev/stdin (and a few similar attempts), cliclick simply exits immediately and doesn't read from stdin/the terminal.

I'm doing this because I was trying to control a home theatre app with cliclick, by SSH'ing onto the machine running the home theatre app and having cliclick read from stdin and run commands. Individual commands like cliclick -w 100 kp:return work over SSH of course, but it's cumbersome to type that for every key, as opposed to typing like:

$ cliclick -w 100 -f /dev/stdin
h
j
k
l
:i
etc

This would allow me to interactively control said home theatre app just by typing into the terminal.

Support for repeated commands

I know that cliclick can work from a commands file, or that I could write a bash loop; however, I'd love to see syntax like (inspired by xdotool):

> cliclick --repeat 500 -w 20 c:. => generate 500 click events at the current mouse position, one every 20ms

cliclick has a nice command chaining syntax, so maybe a better approach is to extend the algebra you've already written:

> cliclick -w 20 c:.*500 (same 500 clicks, once every 20ms as before)

allowing paren would enable more complicated logic:

> cliclick (c:.*5 m:+100,+100 w:20)*5 (5 clicks, move, wait, repeat all 4 more times)

cliclick coordinates are off for mac retina

I was using cliclick and it was working great. I've recently switched to a 15" macbook retina display and now c:500,500 click is vertically somewhere in the middle of the screen. The screen is 2880x1800 so that can't be right.

Are there some scaling adjustments I need to make when working on a retina display?

Drag Fails In OS X El Capitan Mission Control

The dragging of spaces to rearrange them in Mission Control works as expected in OS X Yosemite 10.10.5 but fails every time in any version of OS X El Capitan. The click down registers as evidenced by the darkening of the target space, but the space fails to drag. I'm using cliclick as part of an Applescript implementation, for example: do shell script "usr/local/bin/cliclick dd:830,70 w:1000 du:500,70" I'm using cliclick version 3.2.

Addition: Get current cursor type

hi, great utility btw...
I'm using it inside app via an embedded ruby api.
I can get a click position from both ruby and cliclick to work out the offset factor to reliably find the window edge for a window drag resize...
that all works, however I can't work out a edge test to ensure I'm not being masked...
I was wondering if 'The resize-left-and-right cursor (resizeLeftRightCursor)' could be tested for and the dd: x,y target modified until true...
e.g. safe = safe + 10 if not left_right_cursor
drag = %Q[dd:#{@edg},#{safe} du:#{sq},+0]

so I guess it's a 'get cursor' function I'm after. e.g. cliclick gc:#{@edg},#{safe}
not convinced i'm making sense, but thought I'd ask...
john

Drag command.

Hi,
If I have a left and a right Finder's window, and I execute say "cliclick dd:. du:200,300" the current item under the cursor in the right Finder's window is correctly dragged to left window. Ok.

But, if on the left I have an application's window (ImageAlpha) and on the right the Finder's window, the drag command doesn't work anymore (actually neither if the drag command is always run on the app's window without involving the Finder). in short: the cursor moves at the coordinates but any dragging has performed.
So please is there any cliclick tricks to make it work or is it normal?

Homebrew formula for cliclick

It would be cool to suggest a homebrew formula this project
Automatic compile / install with hombrew would be really nice

More “human-like” mouse movements (easing)

For purposes such as scripting screencasts, where things like the movement of the mouse pointer should be perceivable (instead of the mouse jumping around the screen, which is what happens when using cliclick now), it would be nice to have mouse movement easing – probably cubic in/out easing.

This means that a whole series of mouse move events would have to be fired to emulate this.

Reminder: for calculating the easing, this would be sufficient:

// Modeled after the piecewise cubic
// y = (1/2)((2x)^3)       ; [0, 0.5)
// y = (1/2)((2x-2)^3 + 2) ; [0.5, 1]
//
// Source: AHEasing, License: WTFPL
//
// Expects the [whatever action] to be split up into small steps represented
// by a float from 0 (start) to 1 (end). Method is to be called with the float
// and returns an "eased float" for it.
-(float)cubicEaseInOut:(float)p {
    if (p < 0.5) {
        return 4 * p * p * p;
    } else {
        float f = ((2 * p) - 2);
        return 0.5 * f * f * f + 1;
    }
}

Typing does not work in “verbose” mode

When in “verbose” mode (-m verbose), cliclick prints the action (as expected), but does not emulate any key events (= bug).

Example:
cliclick t:'ls -l' kp:return works as expected
cliclick -m verbose t:'ls -l' kp:return does not

Visualization of clicks

To make more perceivable what is going on (cf. #23) when events are scripted using cliclick, it would be helpful if clicks could be (optionally) visualized, similar to what some presentation tools (Mouseposé, OmniDazzle, …) offer.

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.