I see people automating complex tasks on their computers by using scripts. Same here, I love it. When it comes to iTunes, we Mac OS X owners are using AppleScript – and the best place to start looking for all sorts of solutions is Doug’s page. For Windows users their iTunes looks the same, but the AppleScript won’t work. Instead, they can use VBscript or JavaScript to accomplish pretty much similar things. However, I think the Mac people are leading in terms of iTunes scripting solutions that are available for download. And I know that Doug gets lots of requests to provide the same functionality for Windows, too.
Now I had a dream. Wouldn’t it be great to use a scripting language that is available both on Windows and Mac OS X, and create cross-platform iTunes scripts? My pick would be Ruby, as I already know that from Rails development. Mac users need rubygems and rbosa, Windows users just need ruby. Then run this here:
if RUBY_PLATFORM.match('darwin')
require 'rubygems'
require 'rbosa'
itunes = OSA.app('iTunes')
elsif RUBY_PLATFORM.match('mswin')
require 'win32ole'
itunes = WIN32OLE.new('iTunes.Application')
else
#any other platform that has iTunes? add here...
end
itunes.play
Works so far! Do you like that???
Think of ruby scripts that can be used by both Windows and Mac users… Think of script developers on both platforms helping each others… Think of Ruby on Rails applications where you can query and tidy your music collection from any browser window in the world…
Nice. I need to reserve some time to digg more into this topic.
