What’s this all about then?
rb-appscript is a powerful way to automate your Mac. It's similar to Applescript but it's built in Ruby, which means you get to leverage that language's powerful syntax and libraries. Giving you more time to make toasted sandwiches. You want long-winded explanations? We got those.
Please note that these scripts are by no means bulletproof, and are intended to provide examples of application scripting. I take no resposibility for any loss of data or mishaps; you download and run everything at your own risk. That said, I use all of these scripts in a production environment every day (well – more accurately, I use some of these scripts in a production environment most days).
Keynote: Add a Folder of PNGs to This Slide
The source code is sleeping gently, just down there. Hush now, source code.
#!/usr/bin/env ruby -w # rb-appscript code by Ian Haigh : http://ianhaigh.com/ # Fri Dec 4 10:21:35 EST 2009 require 'rubygems' require 'appscript' require 'osax' sa = OSAX.osax('StandardAdditions') app = Appscript.app('Keynote.app') source = sa.choose_folder(:with_prompt => "Choose source:").to_s current = app.slideshows[0].current_slide Dir.chdir(source) Dir.glob("*png") do |f| p f app.add_file(current, :path => [source, f].join("/")) end