Sha256: e185851b31ef50e0b20ce1fa141896d64000fdddccaa5bd9bb25e700ea6f6e44
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
#!/usr/bin/env ruby require "imsg/version" require 'appscript' def formatBuddies buddies retVal = "" count = 1 buddies.each do |buddy| retVal += count.to_s + " - " +buddy.join(',') +"\n" count += 1 end retVal end def is_i str !!(str =~ /^[-+]?[0-9]+$/) end str = "" ARGV.each do |value| str +=value+" " end str = str.chomp(' '); ARGV.clear STDOUT.flush imsg = Appscript.app("Messages") a = imsg.chats.participants.get() b = [] a.each do |v| names = [] v.each do |buddy| names.push buddy.name.get() end b.push names end puts "\n\nTo which chat you wanna send your message?" puts "(You can choose a number or type a buddy name/email)\n\n" puts formatBuddies b response = gets.chomp if is_i response puts "Sending \'#{str}\' to chat number #{response}" `osascript -e 'tell application "Messages" to send \"#{str}\" to item #{response.to_i} of text chats'` else puts "Sending \'#{str}\' to buddy \'#{response}\'" `osascript -e 'tell application "Messages" to send \"#{str}\" to buddy \"#{response}\"'` end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
imsg-0.0.2 | lib/imsg.rb |
imsg-0.0.1 | lib/imsg.rb |