1

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 :)

  • Automator is not a language. It uses compiled plugins written in various languages, and has a Run Shell Script plugin that allows you to directly write shell scripts that call programs in any language you can run in your normal shell. (Opening files and reading to/from the clipboard have existing plugins in Automator as well.) – tubedogg Sep 29 '16 at 19:41
  • While AppleScript is the primary language used with Open Scripting Architecture (OSA), you can use other languages with it such as Python or JavaScript. You also linked RubyOSA though I don't know if it still works. – tubedogg Sep 29 '16 at 19:41
  • It looks like dev has stopped for both the PythonOSA and rubyOSA but maybe it has continued with JS, do you know of any up-to-date RubyOSA examples? – mbigras Sep 29 '16 at 19:47
  • 1
    Take a look at stackoverflow.com/questions/34574939/… – tubedogg Sep 29 '16 at 19:50
  • 3
    Just curious, why do you not want to use AppleScript? BTW It can do everything you mentioned in your example! – user3439894 Sep 29 '16 at 20:06
1

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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .