Shoutbox

[Request] Update Tumblr blog from WLM - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: [Request] Update Tumblr blog from WLM (/showthread.php?tid=81838)

[Request] Update Tumblr blog from WLM by kaourika on 02-23-2008 at 02:06 AM

Tumblr is a really nice personal blogging platform, designed for posting "snippets" rather than large, journal-like posts. I just signed up yesterday, but was immediately impressed with how lite and streamlined it felt.

I was wondering if it is possible to create a script which posts a text update to a specified Tumblr blog from a WLM window. For example, something like /tumblrpost Hello World, and it updates the Tumblr with Hello World. In essence, this would be turning WLM into a "desktop client" for Tumblr.

And if anyone is REALLY creative, perhaps they can find a way to perform other types of updates(image, audio, video), as well?

Information on the Tumblr API
Some existing programs for interacting with Tumblr from the outside Maybe helpful, maybe not. =P You have to be logged in to see this page.

Also perhaps relevant: Each user is given an email that they can use to text updates to via cell phone. I don't have or use a cellphone, but perhaps this would be useful in carrying out remote updates? Just a thought.

Finally, a bonus idea: a system which reads specified RSS feeds, and notifies you of updates to them the via toast. One might thus specify the RSS feeds of friends' Tumblrs.

I'd attempt it myself, but I've never done a script which interacts with forces outside of WLM, and I've no idea where to begin.

Anyway, if this is possible, I hope someone will consider it. Thanks for reading :3


RE: [Request] Update Tumblr blog from WLM by Shadowmancer on 02-23-2008 at 02:11 AM

Maybe try to set up a script to write/send email to that address directly in WLM? That might be feasible although I'm new to the whole WLM Scripting scene. Then set it to run off of /tumblr [stuff to be blogged].


RE: [Request] Update Tumblr blog from WLM by kaourika on 02-23-2008 at 02:16 AM

Woah, you're fast!

Yeah, that's what I was thinking =] However, I don't know if that email address can be used to update from anything but a cell phone (again, I don't use a cell phone so I'm unaware of the standards on these types of things.).


RE: [Request] Update Tumblr blog from WLM by Shadowmancer on 02-23-2008 at 02:17 AM

Send an email from your computer and see if it's updated. An email is almost always just an email from my experience.

So.. log into your email, send one to tumblr, and check back in a few minutes to see if there's an update.


RE: [Request] Update Tumblr blog from WLM by kaourika on 02-23-2008 at 02:21 AM

Woot! Yes, I just tried sending an email from Gmail, and it updated within less than 30 seconds.

It even retained formatting -- I had a raw URL pasted into the email, which Gmail converted into a link. And Tumblr kept it as a link. =D


RE: [Request] Update Tumblr blog from WLM by Shadowmancer on 02-23-2008 at 02:24 AM

Now comes the idea of sending an email from a WLM window. I'll do some searching. You may want to edit your first post and the thread title to "[Request] Send email from a chat window" and such.


RE: [Request] Update Tumblr blog from WLM by -dt- on 02-23-2008 at 02:34 AM

quote:
Originally posted by Shadowmancer
Now comes the idea of sending an email from a WLM window. I'll do some searching. You may want to edit your first post and the thread title to "[Request] Send email from a chat window" and such.
did you read the api? its easier just to use their api to add a post. the api for adding a post is a simple POST Request
RE: [Request] Update Tumblr blog from WLM by kaourika on 02-23-2008 at 02:37 AM

Awesome, thank you! I'll edit the title.

The neat thing is that this email address allows the full range of content to be sent to the Tumblr--

quote:
Add Tumblr to your phonebook:
Post text, photos, MP3s, or videos (if you have Vimeo enabled) directly from your mobile phone. You can use the Subject line to attach a caption to photos. Remember that anyone can use this address, so keep it private. If you need to, you can reset this address.
--but I can't think of how these could be sent from WLM. =/ Although, I must say I'd probably only use it to post images; I doubt I'd do audio and video posts very often.

Also, obviously the email is unique for everyone, so there would have to be a way to set it, and have it remember you.

quote:
Originally posted by -dt-
quote:
Originally posted by Shadowmancer
Now comes the idea of sending an email from a WLM window. I'll do some searching. You may want to edit your first post and the thread title to "[Request] Send email from a chat window" and such.
did you read the api? its easier just to use their api to add a post. the api for adding a post is a simple POST Request

Oops, didn't see this before I made my reply, I'm helping with dinner over here. =P

Anyway, the API stuff is over my head. Hence this request.
So you're saying the email method is more complex than it has to be?
RE: [Request] Update Tumblr blog from WLM by -dt- on 02-23-2008 at 03:11 AM

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);
}


RE: [Request] Update Tumblr blog from WLM by Shadowmancer on 02-23-2008 at 03:31 AM

Heh.. Just started scripting today. ^^; My bad. Seemed like a good start.. ><.


RE: [Request] Update Tumblr blog from WLM by -dt- on 02-23-2008 at 03:34 AM

quote:
Originally posted by Shadowmancer
Heh.. Just started scripting today. ^^; My bad. Seemed like a good start.. ><.
it is, use the code in my post and do the things in the TODO part :)
RE: [Request] Update Tumblr blog from WLM by Shadowmancer on 02-23-2008 at 03:36 AM

Thanks. If you got time could you look into my thread on variable sharing?


RE: [Request] Update Tumblr blog from WLM by kaourika on 02-24-2008 at 12:51 AM

YAY!! dt, that's exactly what I was hoping for, and it works beautifully! Thank you! I especially love how you made the toast bring you to the post when clicked. That's very slick :0! A noob like myself also very much appreciates the commenting. :3

I'm seeing about doing some of the things on the to do list (although some of it I know for sure I can't do myself). First up was to allow sending text Tumblrs from the conversation window. Frustratingly enough, it didn't go well.

I thought I'd just save the desired text into a variable, tumblrText. I can tell this much is working, as when I send 'ChatWnd.SendMessage(tumblrText)' to the chatwnd, everything displays as intended.
But when I 'sendTumblr(tumblrText)' to the Tumblr, it prints "undefined" for the variable =/

So I guess this isn't the appropriate way to go about storing then sending text externally?