Skip to content

Instantly share code, notes, and snippets.

@macks
Created December 29, 2011 22:57
Show Gist options
  • Save macks/1536581 to your computer and use it in GitHub Desktop.
Save macks/1536581 to your computer and use it in GitHub Desktop.
Controll iTunes from Ruby script using WIN32OLE
require 'win32ole'
app = WIN32OLE.new('iTunes.Application')
# p app.ole_obj_help
# p app.ole_methods
tracks = app.LibraryPlaylist.Tracks
puts "Num of tracks: #{tracks.Count}"
tracks.each do |track|
%w(Artist Name Album).each do |name|
puts "#{name}: #{track.__send__(name)}"
end
puts
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment