There’s a cliche that says necessity is the mother of invention. Well, maybe. In my case I typically make things not because I need them, but because I’m kinda lazy. I’m especially lazy when it comes to repetitive, boring grunt work of the kind that computers were invented to solve in the first place. Here’s a tale not of need, but of frustration; a frustration born out of a growing desire to do something that should be really freakin’ easy, but the tools didn’t seem to exist to facilitate it.
For those who don’t know, I have a sex and porn blog. As you’d expect, it’s totally not safe for work so if you’re reading this at work and you click on this link, you’re either a moron or have really laid back work environment. It’s mostly an images blog with occasional commentary, but for 98% of the content, it’s merely sexy cool images I found and want to share with my readers. (I seem to have quite a few of them. Really, I’m shocked because it’s not like my porn blog has anything special about it save my taste in content.) So, you’d think that’d there’d be a really easy way to point a bit of software at a directory of images and say “Hey! Post all these to my blog, ‘kay?”
I’ve looked. Believe me. I’ve looked for tonnes of ways to automate that part of my blogging. I’ve got a directory full of images… post them. Nope, at least not easily and not on Tumblr. I want to send them one at a time because I want a separate post for each image rather than the Flash based montage effect Tumblr does when you send multiples at the same time.
So what do?
Well, I’m not a software developer but I can code my way out of a paper bag if you simultaneously offer me money, sex, and hold a gun to my head. I took a look at the problem and tried to figure out if there was a way I could solve it using my limited software development abilities. Turns out, there is. All I need are some already existing tools.
First off, you have to know that, when you sign up for Tumblr, you get a super secret email address to send posts in rather than writing them online. That way you can easily send photos shot on your cell phone, or dash off a quickie email at the office or on your iPod. That proves to be the key. Now, I could individually email each picture (remember I can’t send them all at once or they get montaged) but after the first 20 or so, that’s starting to take time and make me think there has to be an easier way. But email, the workhorse of the Net, can do a lot of things, all you have to know is how to ask.
Automating an email programme is a possibility, but it’s clunky as none of the email programmes I have access to automates very easily or very well. What I need is some simple way to do it and you can’t get much more simple than a command line programme that does nothing more than send e-mail. I found a programme called SendEmail that, predictably enough, sends email right from command line. It’s a Linux like command line programme where you type a string of characters a mile and a half long and then hit Enter and pray that you didn’t fat finger something and erase your hard drive. Thing is, since it has a command line interface, I can automate that really easily.
After figuring out the syntax for sending an e-mail, I entered my secret Tumblr address as the recipient set the command to send it through my Gmail account. I copied that info to a batch file placing the most important bit of the command at the end: the attachment. That attachment is, of course, the picture(s) that I want to send. I left that part of the command blank because I was going to call upon that batch file to post the image, and feed it changing file names for each image. Now then, I don’t know a lot about batch file programming. I know that you can do some great things with them, but I simply don’t know how.
But I do know how to do that stuff with AutoHotKey. AutoHotKey is a programming language that’s kinda like batch files on steroids. You can use it to create programmes and macros that do all kinds of cool stuff. I use a lot when it comes to repetitive computer tasks that shouldn’t exist because that’s what computers are supposed to fix. I wrote up a quick and dirty programme that does a couple of things. First, it asks me how many images I want to post and, if I need it to, it asks for which e-mail address I’d like to send it to.
There’s a little prep work. To keep the coding simple, I put the images I want to post in the same directory as my programme and SendEmail. I name them post1, post2, post3, etc. That way, the programme looks only for those images and that sequence. I can have as many of them as I want as long as they follow the pattern.
The programme is simple after that. I launch it and tell it how many images I want to post. That way it knows when to stop. The programme calls on that batch file and feeds it the file data, looping over again until it hits the final number. Each time the batch file e-mails the image to Tumblr and Tumblr posts the image. It’s fire and forget because I typically launch it and walk away.
Over the last few hours I’ve sent over 70 images to my sex blog and all it took was telling the programme how many images to send. No bugs so far, no errors. After all, it’s a simple programme doing a simple task.
Why in the hell did I have to write it?
I’m going to fiddle with the code for the next couple of weeks and make it a little more advanced so I don’t have to rename the image files. I know this can be done, I just have to learn how it works in AutoHotKey. If you think you might want such a thing for yourself, leave a comment or drop me an e-mail at greatwesterndragon (at) gmail dot com. I’ll let you know when it’s ready for other folks to use it.