MacOS – How to start scripting automation on OS X without AppleScript or Automator

automationbashmacosrubyterminal

I want to start writing scripts to automate common use cases in OS X El Capitan 10.11.6. I'd like to work with ruby but I'd be willing to learn any high level language to do it with the exception of AppleScript. I'd also like to avoid Automator when possible and just stick with "regular" programming tools like text editors. I'm not opposed to using those tools as wrappers, but I'd like to do most of the work with a "real" scripting language like ruby, bash, python, perl, etc… I know how to use ruby or bash to automate tasks in the terminal. Things like file/directory creation/naming, or changing directories, or launching applications. I also use Alfred to launch many of the ruby or bash scripts I write and I love it! Now I want do things like:

when I run `some-script.rb`
bring the messages app into focus
resize it to be XxY
move it to the top left corner
open the terminal app
open vim
move it bellow the messages window
open somefile.txt
place cursor in terminal

Or something like that. I want to start exploring what's possible with automating various things I do while using the OS X GUI rather than just the terminal. I've found a couple sources:

But essentially all of them except RubyMotion seem outdated, and RubyMotion seems like it's more for building applications and not for automating every day tasks, but I'm not sure.

Maybe this is possible with Alfred too, I'm not sure, but I've been researching around and haven't found any up-to-date tutorials on how to start piping together common tasks like window resizing, opening files in an editor, or putting stuff onto the clipboard, on OSX. Would love some help and guidance on this!

Thanks 🙂

Best Answer

There is mention in another post which references this somewhat recent and seemingly well documented project BrendanThompson/rb-scpt