Windows Live Writer Plugins & Dirty Diapers!
I've been playing around with Windows Live Writer for a little while now (since it first came out in beta!) and the more I use it, the better it seems to get (in case you haven't used it, I encourage you to check it out).
The only "problem" I've had so far is my lack of understanding on how to create plugins for it. Well my friends - I've worked it out and I intend to share it with you now!
Oh! Before I go any further, let me explain the title of this post...
I've been wanting to write this post for a little while now, but this is the first chance I've had to sit down and have some "time to myself". My wife and I welcomed our new baby daughter into the world a few weeks ago and since then my world has been turned upside down! When I'm not changing diapers, or bonding my her and my wife, I like to try and catch up on the little sleep I seem to be getting at the moment! But just for you (OK.. and me!) I have managed to escape to my office for a while and finally get this article "out the door"... ;)
Anyway, let's get going!
The first step to writing a plugin was working out what I wanted it to do. I finally settled on creating a plugin to insert a thumbnail image of any given web page and have it appear as an image in your blog post.
I was going to write this post about how you create a plugin yourself, but I thought the best way to show you would be to provide the source code for my plugin!
A few points worth mentioning...
- When creating a plugin, make sure you add a reference to the WindowsLive.Writer.Api.dll file located in the Program Files\Windows Live Writer directory.
- Make sure you add attributes to your class describing the plugin. This is how Windows Live Writer "learns" about your plugin. Mine looks like this:
[InsertableContentSource("Website Image"),
WriterPlugin("32a77b7a-5ea4-47be-84fc-ff7471384e10",
"InsertWebsiteImagePlugin",
ImagePath = "Web.png",
PublisherUrl = "https://blogs.msdn.com/jasonward/",
Description = "Inserts a thumbnail image of a website into the Live Writer Window"),
LiveClipboardContentSource("html", "text/html"),
UrlContentSource("https://(.*)",
ProgressCaption = "Capturing Website Image..",
RequiresProgress = true)]
public class InsertWebsiteImage : SmartContentSource
So what's the plugin called and where can I get it?
It's called "Insert Website Image" and you can download it from here!
All source code can also be downloaded from here!
Hope this helps,
Jason
p.s - I've hosted all the source code on codeplex, so if you'd like to contribute to this plugin or perhaps even add your own plugin to this project, please let me know!