Showing posts with label skype. Show all posts
Showing posts with label skype. Show all posts

Thursday, February 4, 2010

Death Agony!!!

Sometime I use many PC for automation integration testing.
But it is difficult to manage which one down by error.
So when some PC down,the PC death agony! by skype.
This code will death agony and vomit log.

# death_agony.rb
#! ruby -Ku
require 'rubygems'
require 'win32ole'
require 'kconv'

$KCODE = 'UTF8'
@MACHINE = ARGV[0]
@GOD = ARGV[1]

@oCom=WIN32OLE.new('AutoItX3.Control')
@oSkype=WIN32OLE.new('Skype4COM.skype')
raise "Please start skype" @oSkype.Client.IsRunning != true

death_agnoy = IO.read('errIO.txt')
@oSkype.SendMessage(@GOD, "Death Agony from #{@MACHINE} at #{Time.now}\n" + death_agony)
sleep(3)

@oUser = @oSkype.User(@GOD)
@oCall = @oSkype.PlaceCall(@oUser.Handle)
@oCall.Status

And catch exception in rake task(who don't use rake for testing?)

# rake.rb
# setup >(rake your_task pc=a_one_of_sacrifice p=where_to_agony) 1> errIO.txt
task :hell_grinder do
begin
ruby "death_test.rb "
rescue
p "ring ring ring..."
ruby "death_agony.rb " + ENV['pc'] + " " + ENV['p']
end
end

Then you can hear death agony from each sacrifice.
*Don't forget regsvr skype dll:here down load link
How to regist it.
> regsvr32 -that skype dll-
Ahhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh........

Wednesday, November 11, 2009

Skype mood to twitter by COM

Skype mood to twitter.
Skypeのムードをtwitterにpost。

on windowsXP
requirement

Useage
cmd.exe
>gem install twitter4r
>regsvr32 Skype4COM.dll <--when popup dialog,should 'OK'
>ruby mooding.rb
then every 5 sec. ruby check skype mood and updated at that time,post it to twitter.
だいたい5秒おきに、skypeのムードが更新されたか確認して、されてれば、twitterにポストします。下記コードのみ。
for stopping,止め方、Ctrl+C

#! ruby -Ku
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 almost 5sec.
end
end

Tuesday, July 14, 2009

Get skype for Debian Lenny

# vim /etc/apt/sources.list
ADD:
deb http://download.skype.com/linux/repos/debian/ stable non-free
then
aptitude update
to install the skype:
# aptitude install skype