Apple infrared remote control After playing with iremoted and Ruby’s IO.popen I guess I am convinced that Ruby really works as a glue on many levels.

So, using iremoted and capture Apple remote commands in the terminal it is trivial to use the remote to control a Ruby application. Of course, calling OS commands isn’t limited to Ruby.

Here is a minimal dungeon game which you control with the apple remote. If you ever manage to find your way out I would be surprised…

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
IO.popen ("/Applications/iremoted") { |f|

x = y = 0

puts "You are standing in an open field west of a white house, with a boarded front door..." while (line = f.gets.chomp) 
if line == "Plus released" y += 1 end

if line == "Minus released" y -= 1 end

if line == "Previous released" x -= 1 end

if line == "Next released" x += 1 end

puts "You are at coordinate #{x}, #{y}." end } 

Who will be first to create a terminal based media center application using Ruby? With some more glue from RubyOSA (the Ruby/AppleEvent Bridge) it should’t be that hard.