Heres some code for anyone who wants to build on it.
code:
/*
TODO:
- make a gui for setting the config values and store them into the registry
- allow sending tumblrs from the conversation window
- design a gui for sending longer tumblrs
*/
/*
config values
*/
var username = "username";
var email = "email";
var password = "password";
/*
initialize and send a tumblr
*/
function OnEvent_Initialize(MessengerStart){
sendTumblr("moo title", "moo body");
}
/*
Sends a post request to the Tumblr write api as defined here http://www.tumblr.com/api
It shows a toast on success/fail
*/
function sendTumblr(postTitle, postContent){
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.open("POST", "http://www.tumblr.com/api/write", true);
xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState==4) {
if(xmlhttp.status == 201){
MsgPlus.DisplayToast("tumblr", "Post Added", "", "OnTumblrToastClick", xmlhttp.responseText);
}else{
MsgPlus.DisplayToast("tumblr Error", xmlhttp.status + " " + xmlhttp.responseText);
}
}
};
xmlhttp.send("email=" + encodeURIComponent(email) +"&password=" + encodeURIComponent(password) + "&type=regular&title=" + encodeURIComponent(postTitle) + "&body=" + encodeURIComponent(postContent));
}
/*
if the post works and the user clicks the toast that shows, then the post will open
*/
function OnTumblrToastClick(param){
new ActiveXObject("wscript.shell").run("http://" + username + ".tumblr.com/post/" + param);
}