One big issue with my original code was not stripping the gets-- the 
username and password were tailed by \n's.

"sleep 1" after the client connects and after the message is sent allow 
the script to work.

I'm still trying to see what I can do with the .wait method.

I was able to get rid of the sleeps by looping the program, giving the 
user a chance to send another message after the process completes.

#Loads net/toc, aim gem
require 'rubygems'
require 'net/toc'

#Get username, password
puts "Screenname:"
username = gets.strip
puts "Password: "
password = gets.strip

#Define TOC Connection
client = Net::TOC.new(username, password)

#Connect
client.connect

#Create screenname variable
screenname = nil

#Loop until it receives the exit command
while screenname != "*"

#Get buddy's screenname
puts "Buddy's Screenname(or '*' to exit):"
screenname = gets.strip

#Check for exit command
if screenname == "*"
  client.disconnect
else

#Get message
puts "Message: "
message = gets.strip

#Grab object associated with buddy's screenname
friend = client.buddy_list.buddy_named(screenname)

#Send the IM
friend.send_im(message)

end
end

-- 
Posted via http://www.ruby-forum.com/.