Created
April 7, 2010 08:11
-
-
Save tknv/358649 to your computer and use it in GitHub Desktop.
mood2twit
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
#! 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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.