I wrote a WSH script, skype2twitter.js, which allows you to post your mood text set on Skype client to Twitter. After setting your username and password of Twiter, just run it. Then, the script checks your mood text, and posts it to Twitter if changed.
Be sure that now it just only posts the mood text to twitter, that is, it doesn't synchronize the mood text and the status on Twitter, which can be updated from Web, IM or the other various places. I expect someone to enhance it to enable to do it.
To tell the truth, what I did with the script is just to mix this script and another one. Thank to them!
// configurations
var username = 'username';
var password = 'password';
var interval = 60000;
var status;
var skype = newComObject("Skype4Com.Skype");
var ua = createUserAgent();
while (true) {
if (status == skype.CurrentUserProfile.MoodText) continue;
status = skype.CurrentUserProfile.MoodText
postStatus(ua, username, password, status);
WScript.Sleep(interval);
}
function postStatus (ua, username, password, status) {
try {
ua.open(
'POST',
'http://twitter.com/statuses/update.json',
false,
username,
password
);
ua.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
ua.setRequestHeader('X-Twitter-Client', 'Skype2Twitter');
ua.setRequestHeader('X-Twitter-Client-Version', '0.01');
ua.setRequestHeader('X-Twitter-Client-URL', 'http://blog.kentarok.org/2007/04/10/skype2twitter.xml');
ua.send('status=' + encodeURIComponent(status));
if(ua.status == 200) {
print('Updated: ' + status);
}
else {
print('Error: ' + ua.status + ' - ' + ua.statusText);
}
}
catch (e) {
print (e.message);
}
}
function createUserAgent () {
try{
return new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e) {
try{
return new ActiveXObject('Microsoft.XMLHTTP');
}
catch(e){
return null;
}
}
}
function newComObject (lib) {
var obj;
try {
obj = WScript.CreateObject(lib);
}
catch(e){
obj = new ActiveXObject(lib);
}
return obj;
}
function print (string) {
WScript.Echo(string);
}
Comments (2)
Hi, I just made some improvement on your code to change it from periodical checking to processing mood message update event. I named it smitter - Skype Mood Message to Twitter. Take a look at http://hi.baidu.com/tvbinstinct/blog/item/b374f0deef16ae5694ee37a4.html if you want. Thank you for your work.
Posted by tvbinstinct | June 26, 2007 4:11 PM
Posted on June 26, 2007 16:11
Great! It looks definitely nicer than mine. I hope it would become easier to post mood texts to Twitter by Twitter's supporting Skype.
Posted by kentaro | June 27, 2007 1:00 PM
Posted on June 27, 2007 13:00