Coder Social home page Coder Social logo

simudream / osxautomation Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joseph/osxautomation

0.0 2.0 0.0 92 KB

A small command-line utility for automating mouse and keyboard input within Mac OS X.

Home Page: http://gadgets.inventivelabs.com.au/castanaut

C 77.58% Groff 21.50% Shell 0.92%

osxautomation's Introduction

OSXAutomation

A small command-line utility for automating mouse and keyboard input.

Developed for the Castanaut (http://github.com/joseph/castanaut) Ruby gem, which lets you script a "screenplay" of interactions with Mac OS X, and potentially record it into a screencast.

Initially developed by Joseph Pearson of Inventive Labs (http://inventivelabs.com.au) and released under the WTFPL.

Requirements

  • Xcode

Building and running

You can build the project in Xcode or from the commandline with the xcodebuild utility. Two scripts are provided in the scripts directory for development convenience. For example:

Build the utility and test it, moving the mouse to 100x100 on your screen.

$ scripts/buildrun "mousewarp 100 100"

Run the existing built executable, typing a short message:

$ scripts/run "type foobar"

For general use, move the utility from build/Release/osxautomation to somewhere in your path (eg /usr/local/bin) and run like, eg:

$ osxautomation "mouselocation"

(This example will print the mouse coordinates.)

You can chain commands with consecutive arguments:

$ osxautomation "mousemove 300 400" "mouselocation"

Commands

A list of the current input commands:

  • mouselocation - prints the pixel coordinates of the mouse cursor
  • mousewarp <x> <y> - jumps the mouse cursor to these pixel coordinates
  • mousemove <x> <y> - steadily moves the mouse cursor to these coordinates
  • mousedown <integer> - depresses the mouse button identified by the integer
  • mouseup <integer>
  • mouseclick <integer>
  • mousedoubleclick <integer>
  • mousetripleclick <integer>
  • mousedrag <x> <y> - depresses the left mouse button (1) and moves the mouse to the given coordinates, then releases the button
  • press <keycode> - depresses the keyboard key identified by the keycode
  • release <keycode> - releases the key identified by keycode
  • hit <keycode> - depresses and releases key
  • type <string> - types out a string steadily to whatever has focus
  • wait <integer> - pauses execution for seconds

A code quality caveat

It works. It may not be elegant or future-proof, or accept the widest possible variety of inputs. I'm not a Mac OS X developer, but two years ago I had an itch and this scratched it. YMMV.

Please contribute improvements (but be aware that the command-line interface must remain stable if I am to integrate changes - Castanaut is dependent on this utility).

License

Copyright (C) 2010 Inventive Labs.

Released under the WTFPL: http://sam.zoy.org/wtfpl.

This program is free software. It comes without any warranty, to the extent permitted by applicable law. You can redistribute it and/or modify it under the terms of the Do What The Fuck You Want To Public License, Version 2, as published by Sam Hocevar. See http://sam.zoy.org/wtfpl/COPYING for more details.

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.