Skip to content

Instantly share code, notes, and snippets.

@tknv
Created April 7, 2010 08:11
Show Gist options
  • Save tknv/358649 to your computer and use it in GitHub Desktop.
Save tknv/358649 to your computer and use it in GitHub Desktop.
mood2twit
#! ruby -Ku
# mood2twit.rb
require 'rubygems'
require 'win32ole'
require 'twitter'
require 'kconv'
$KCODE = 'UTF8'
@oTwitter = Twitter::Client.new
twit_id = ARGV[0]
twit_pwd = ARGV[1]
if @oTwitter.authenticate?(twit_id, twit_pwd) == true then
p 'OK auth'
else
raise 'ID,Passwd or both is not collect'
end
@oSkype=WIN32OLE.new('Skype4COM.skype')
mood = nil # Anyway 1st time twit mood
loop do
if @oSkype.Client.IsRunning != true then
raise "Please start skype"
else
end
if @oSkype.CurrentUserProfile.MoodText.toutf8 != mood then
mood = @oSkype.CurrentUserProfile.MoodText.toutf8
@oTwitter = Twitter::Client.new(:login => twit_id, :password => twit_pwd)
@oTwitter.status(:post, mood)
else
sleep(5) # check mood update every apploximately 5sec.
end
end
@tknv
Copy link
Author

tknv commented Apr 7, 2010

usage : ruby mood2twit.rb twitterID password
*Don't forget regsvr skype dll:here down load link-http://developer.skype.com/accessories
How to regist it.

regsvr32 that skype dll

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment