Created
May 2, 2011 02:17
-
-
Save bmnick/951103 to your computer and use it in GitHub Desktop.
That's what she said autoresponder for iChat
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'twss' | |
# Read in from command line arguments | |
input_value = ARGV.shift | |
# make it more common | |
TWSS.threshold = 3.0 | |
# Provide output that should be easy for applescript to parse | |
if TWSS(input_value) | |
puts "yes" | |
else | |
puts "no" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using terms from application "iChat" | |
# Register event handler | |
on message received theMessage from theBuddy for theChat | |
# Hand the input to the shell script | |
set x to do shell script "/Users/ben/.rvm/bin/ruby-1.9.2-p180 /Users/ben/Applications/twss.rb \"" & theMessage & "\"" | |
if x is equal to "yes" then | |
# send the message back | |
tell application "iChat" | |
send "That's what she said!" to theBuddy | |
end tell | |
end if | |
end message received | |
end using terms from |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment