What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » [Request] Update Tumblr blog from WLM

[Request] Update Tumblr blog from WLM
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: [Request] Update Tumblr blog from WLM
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);
}


This post was edited on 02-23-2008 at 03:12 AM by -dt-.
[Image: dt2.0v2.png]      Happy Birthday, WDZ
02-23-2008 03:11 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
[Request] Update Tumblr blog from WLM - by kaourika on 02-23-2008 at 02:06 AM
RE: [Request] Update Tumblr blog from WLM - by Shadowmancer on 02-23-2008 at 02:11 AM
RE: [Request] Update Tumblr blog from WLM - by kaourika on 02-23-2008 at 02:16 AM
RE: [Request] Update Tumblr blog from WLM - by Shadowmancer on 02-23-2008 at 02:17 AM
RE: [Request] Update Tumblr blog from WLM - by kaourika on 02-23-2008 at 02:21 AM
RE: [Request] Update Tumblr blog from WLM - by Shadowmancer on 02-23-2008 at 02:24 AM
RE: [Request] Update Tumblr blog from WLM - by -dt- on 02-23-2008 at 02:34 AM
RE: [Request] Update Tumblr blog from WLM - by kaourika on 02-23-2008 at 02:37 AM
RE: [Request] Update Tumblr blog from WLM - by -dt- on 02-23-2008 at 03:11 AM
RE: [Request] Update Tumblr blog from WLM - by Shadowmancer on 02-23-2008 at 03:31 AM
RE: [Request] Update Tumblr blog from WLM - by -dt- on 02-23-2008 at 03:34 AM
RE: [Request] Update Tumblr blog from WLM - by Shadowmancer on 02-23-2008 at 03:36 AM
RE: [Request] Update Tumblr blog from WLM - by kaourika on 02-24-2008 at 12:51 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On