Skype on Quicksilver

This thing started after I found out how nice is quicksilver giving access to applications, files, commands in your computer, etc ... so i thought: When i want to chat to my Skype contacts, i want to be able to do it just by typing their names in quicksilver, why not?


First, the Address Book contacts are searchable by Quicksilver, and we can even get their phone numbers from there.


Then, the Skype client has some services available for Quicksilver access:
  • Skype/Send Message
  • Skype/Send SMS
  • Skype/Call
So, if we have a contact on Address book we can search by this contact name, get contact phone number and use one of these services, all from inside quicksilver. Even more, if we add to an Address book contact the skype username as a phone number, voilá! all accessible from Quicksilver!
How to get Skype contacts into the Address book ? do something like this:
  1. Use Skype Windows Client to export all contacts into vcards.
  2. Use a little ruby scripting to make some transformations on the vcards.
  3. Import the resulting vcards into Address Book.

End Result

Control-Space and search for a contact:








Select the "other phone"(that contains Skype username)







Tab->write "send m"->enter









Have a Skype chat open.




















Nice Side Effects
  • First of course, is having the Address book filled with all Skype contacts information, their emails, their phones, etc ... All searchable by quicksilver.
  • Because mac has great application integration we can have Mail aware of Address Book contacts.
  • Having a isync compatible phone, means that you can have all your Skype contacts with numbers, addresses even notes, inside the phone.

Ruby Code


#!/usr/bin/ruby -w

require 'vpim/vcard'

$FINAL=""
vcf = open(ARGV[0] || 'al3x.martins.vcf')

cards = Vpim::Vcard.decode(vcf)
tempdir = "all_contacts"
`mkdir #{tempdir}`

#separate vcards
iter = 1
cards.each do |card|
open( tempdir +"/" + iter.to_s + "_temp.vcf", 'w').write card.to_s
iter +=1
end

# Extract the Photos
Dir[tempdir+"/*vcf"].each do |file|
vcard = open(file).read
card = Vpim::Vcard.decode(vcard)[0]
photo = card.photos[0]
photodata = [photo.to_s].pack('m').to_s
photodata = photodata.gsub(/[ \n]/, '').scan(/.{1,76}/).join("\n ")
vcard.sub!('END:VCARD', "PHOTO;BASE64:\n " + photodata + "\nEND:VCARD")

vcard.sub!('X-SKYPE-USERNAME:', 'TEL;SKYPE:')

value = vcard.scan(/FN:(.*)/).flatten.to_s
val2 = value.split(' ')
if val2.size <= 1
vcard.sub!(/^N:(.*)/, 'N:;'+val2.flatten.to_s+';;')
else
final = val2.last + ';'
final += val2[0] + ';'
final += val2[1...-1].join(' ') + ';'
vcard.sub!(/^N:(.*)/, 'N:'+final)
end

vcard.sub!('X-SKYPE-SEX:2', 'Sex: female')
vcard.sub!('X-SKYPE-SEX:1', 'Sex: male')
vcard.sub!('X-SKYPE-LANGUAGE', 'Language')
vcard.sub!('X-SKYPE-COUNTRY', 'Country')
vcard.sub!('X-SKYPE-CITY', 'City')
vcard.sub!('X-SKYPE-MOOD', 'Mood Message')
vcard.sub!('X-SKYPE-PROVINCE', 'Province')
vcard.sub!('X-SKYPE-NUMBER-OF-BUDDIES', "Number of Skype Buddies")

`rm -f #{file}`
open(tempdir+"/"+value.sub('/','_').sub('/','_').sub('/','_') + '.vcf', 'w').write vcard.to_s

end

`say its all done`


No comments: