Archive for category Windows Live Writer

Storing Live Writer’s Posts on a network share or anywhere actually

All of Windows Live Writer’s posts, both drafts and published posts, are stored in the “My Weblog Posts” in your Documents folder. Currently, there is no option to change this, however, there is a way you can fool Live Writer into thinking it’s still there! This means that you could save them onto a separate partition/hard drive, or even onto a network share (like on your WHS should you have one). Let me show you how you accomplish this.

***********Disclaimer************
If you use this post to change your My Weblog Posts to a network share and that network share goes offline, Writer will not open. At all! Similarly, if you change it to removable drive and that drive isn’t plugged in! So don’t whinge about Writer not opening. You can fix it though by going to your Documents folder and deleting the My Weblog Posts folder that’s there (it should have the shortcut arrow if it’s the one pointing to another location).

I should also note that there may be other niggles that I haven’t seen yet, so this really is an “at your own risk” job and I take no responsibility if you screw this up
********End Disclaimer***********

A couple of things to say before we get going, saving them to a network share will only work in Windows Vista or Windows 7. You can save them to a different partition or hard drive in XP, but that is all. Because of this, I will split this post into two sections, Windows XP, and Windows Vista/7. You will also need Administrative rights to be able to do this.

Windows Vista/Windows 7

Start off by completely moving your My Weblog Posts folder to the location of your choice, whether it be locally to that PC or on a network share. Make sure the original folder no longer exists. For this example, I will be putting it on my network share on my Windows Home Server.

  1. Click Start
  2. Type “cmd” but don’t hit enter just yet! Right click the cmd.exe that appears in the search and Run as Administrator:
  3. In the command prompt, type “mklink /D “<YourCurrentPostsFolder>” “<YourNewPostsFolder”” where <YourCurrentPostsFolder> is the old location (eg, C:\Users\<user>\Documents\My Weblog Posts\) and <YourNewPostsFolder> is where you’ve moved it to (eg, \\server\share\My Weblog Posts\). An important thing to remember is to include quotes around the two folder locations, so it should look like this:
  4. Hit enter. As long as you are able to access that share, then it will work in Writer as if they were still in the same place they always have been.

This same method could be used if you want to have your posts on a different drive/partition on your local machine, it doesn’t just have to be for network shares.

Windows XP

Now, as mentioned, you can’t do this for network shares in XP, but you can move it to another location on your PC. Start off by completely moving your My Weblog Posts folder to the location of your choice. Make sure the original folder no longer exists.

  1. Download Junction from the Microsoft Sysinternals site. Extract to the root of your C drive.
  2. Open a cmd window as an administrator. If you’re in a limited account, go to Start > All Programs > Accessories and right click on the Command Prompt shortcut then Run As.. and let an administrator log in. If you have an administrative account, just do Start > Run > “cmd” > enter.
  3. In the command prompt, type “c:\junction.exe “<YourCurrentPostsFolder>” “<YourNewPostsFolder”” where <YourCurrentPostsFolder> is the old location (eg, C:\Documents and Settings\<user>\My Documents\My Weblog Posts\) and <YourNewPostsFolder> is where you’ve moved it to (eg, d:\data\My Weblog Posts\).
  4. Hit enter. This will now create you the link to your new Posts folder.

And there you have it, how to fool Live Writer into letting you use another folder location. One final reminder, please read the disclaimer at the top of this post!

SL

Advertisements

4 Comments

CS 2008 + IE8 + Windows Live Writer CTP = Fail!

Some of us on Liveside have been having issues using Windows Live Writer CTP when opening some of our previous posts (or any drafts we have saved). The problem is that the post starts to open in Writer, then just dies. Completely. No error, no warning, nothing. We couldn’t work out what had changed, but after Sunshine had spoken with Joe Cheng they established that problem was being caused by Internet Explorer 8 when the posts had images in them. However, I wasn’t as easily convinced, since I could open posts from this blog and my personal blog just fine, which made me think it’s something specific to Liveside.

Now, the difference between my blogs and Liveside is that we now use Community Server 2008 and my blogs use Live Spaces, so I fired up one of my test CS 2008 blogs on my machine, and tried the same thing: created a post for that blog with an image in it, then save it as a draft; close writer then reopen and try and open that draft. Sure enough, Writer just closed. So it seems it’s not something specific to Liveside, but something specific to how IE8 renders the CS code that Writer is using.

Now, the good thing is, that at the moment, the workaround for this is to turn off editing with theme, so before you open a post with images for your CS 2008 post, click on View > Edit Using Theme (or just make sure it’s not ticked). Doing that disables all the CS code and opens your post just fine.

I’m going to try and pass this to the relevant channels: The Writer Team, the IE Team and Telligent. Hopefully between them, they can sort it out. In the meantime, well, there’s the workaround for it.

SL

Whilst writing this, I was listening to John WilliamsIn The Devil’s Snare & The Flying Keys

4 Comments

New Writer Plugins Using The New SDK

As mentioned, and demonstrated, there is a new SDK for Live Writer and true to form, I have been beavering away with them writing up new plugins. This post will showcase the 6 plugins I’ve written using the new SDK. So let’s jump straight into it.

Emotify Plugin

You might remember that the first plugin I ever wrote for Live Writer was my Insert Emoticon plugin, where you clicked on the insert link on the right, chose your emoticon and put it in your post. Well I always found that to just be tedious and a pain, so with this new SDK, I can now take it one step further. So I have added to the original plugin and now you can simply do a Live Messenger emoticon code in your post The plugin will ask you if you want to emotify your post, or you can set the options to let the plugin do it automatically. This plugin was made using the PublishNotificationHook base class. I must note, this plugin requires .NET 3.5 to run (I wanted to try out some LINQ to XML. Joe is trying to persuade me to create one that is .NET 2.0 friendly, and I’ll try to, but for now, this is .NET 3.5. Would also like to thank Inky for his invaluable help with the regular expressions that do all the gory work. Thanks dude

Now Playing

There are many different plugins that allow you to put what you’re listening to into your blog and I think I’ve used each one, but this is a perfect example of a plugin that could utilise the HeaderFooterSource base class. And that’s exactly what I’ve done. The plugin itself is nothing special, it doesn’t even have its own API, but what it does allow is for you to customize what you want it to say and what parts of the song to show:

Now, a couple of things about this plugin, for it to work, you need to have the Windows Media Player blogging plugin which you can download here for XP or here for Vista. If you’re using iTunes, then you don’t need to install anything else, the plugin will query iTunes itself for the currently playing information.

Capitalize Title

This is a very simple plugin that will check to see if your blog title is using capital letters for the first letter of each word, if this isn’t the case, then it changes that. So a blog title would look like this: A New Blog Post Entry With Capital Letters (rather than: a new blog post entry with capital letters).

Signature Plugin

This plugin is quite unique as it has per blog settings! What this plugin does is uses the HeaderFooterSource and at the end of the blog entry will put a signature (like SL in my case). Now sometimes you want to use different signatures for different blogs (if you have more than one configured), so this plugin allows you to have different signatures for each blog configured!!

Bold Hyperlink Plugin

This was a request from Steve Clayton who wanted all of his hyperlinks to be bold, so that’s what this plugin does. It checks the contents of the blog entry and makes all the hyperlinks in the blog post bold.

Profanity Checker

This plugin was something I discussed with the Writer team as a good example of the PublishNotificationHook base class for checking the contents of a post and cancelling the publish if certain criteria are met. So this allows you to configure what words would cancel a blog post from being published, and just to make sure they can’t easily be changed (say by a child), you have to password protect them

ScottIsAFool.WriterUtilities

For some of these plugins, they all required some common code, so I have started compiling my own WriterUtilities static class. Now one of the methods you’ll find is a nice little trick for your Writer plugins. In the IPostInfo interface, all the properties (like title, contents, keywords, etc) are read only, so you can’t actually change them using your code. But wait a minute, isn’t that what I’m doing with at least 3 of the above plugins? Yes, yes it is. Using this WriterUtilities class, you can also change it too, but be warned, it is unsupported by Microsoft (and me ). Here is a quick example of how to use the class:

        public override bool OnPrePublish(IWin32Window dialogOwner, 
            IProperties properties, IPublishingContext publishingContext,
            bool publish)
        {
            string newtitle = "My New Title";
            return ScottIsAFool.WriterUtils.ReplaceText(publishingContext.PostInfo,
                newtitle,
                PostItems.Title);
        }

I also have a another method which returns an array of Blogs configured on the system (which I use for my Signature plugin). I should note that this utilities class is only compatible with the CTP and should not be used in the 1.0 SDK!

Source Code

As always I am making the source code for all these available on CodePlex.

Codeplex page: http://www.codeplex.com/NewLiveWriterPlugins
Download page: https://www.codeplex.com/Release/ProjectReleases.aspx?ProjectName=NewLiveWriterPlugins&ReleaseId=14010

All of these plugins should be put in c:\program files\windows live\writer\plugins (or the locale/architecture equivalent).

SL

Whilst writing this, I was listening to AerosmithLay It Down

13 Comments

New Windows Live Writer Version

A little earlier than scheduled (that schedule being tonight), we [Liveside] and mess.be have discovered that the new set of programs are available for download. Using the new Windows Live Installer, you can upgrade your Windows Live programs to the final versions, including Windows Live Writer:

I spent ages jumping through hoops though trying to get the new programs to install, but it kept installing the older versions. I followed the support article but to no avail, in the end, I reset my router, and bingo, got the new programs. So if you keep getting the old programs, try resetting your internet connection.

I don’t believe there is anything new in this version other than bug fixes (which I will try and find out), but I would recommend to be on the latest version.

SL

Whilst writing this I was listening to Lenny KravitzLive

9 Comments

A Thanks for a Thanks

Just wanna say thanks to the Live Writer team for this post: Thank you scottisafool.

"Scott is also a big contributor to our Writer forums, where he and Joe Cheng battle to see who can help our users faster. As a developer on Writer, Joe tends to have the edge because he actually writes the product, but Scott is always quick to catch on if the question comes up again."

What can I say? When a product is actually good, it’s worth helping out on, and Windows Live Writer is definitely worth helping out with. I look forward to seeing future updates, both to the Writer program and to the APIs .

Oh, keep your eyes peeled for a new plugin that I’ll be announcing in the next few days (it’s finished, just waiting for Gallery approval).

SL

Whilst writing this I was listening to DidoThank You

13 Comments

A Tip For Inserting Videos

My video plugin has, I think, a pretty extensive list of video sites that it supports, with more always being added. Unfortunately, not all video service providers can be added to the plugin, so then what? Open Writer up, go to HTML View, put code in, go back to another view, hoping it looks right? Well, not really, there is an easier option that came in with Beta 2 of Writer. If you take the embed code from the video site, copy it, then simply paste it into Writer, the embedded video will get added in automatically.

That will give you this:

Now, this little trick will also work with the video sites that my plugin does support at the moment, however, you won’t get any of the options that my plugin offers, like resizing the video, including the title of the video, etc. I, obviously, would still recommend using my plugin if the site you want is supported by it.

Thanks to Charles for the tip.

SL

21 Comments

Windows Live Writer’s New APIs, Deployment Methods And A Hidden Extra

With last week’s release of beta 2 of Windows Live Writer, the Writer Team released a new set of API documentation, but not for plugin development (sadly), rather for Blog Service Providers to enable features within Writer itself. This means that if a blog service enables a feature that Writer can use, say the excerpt feature, then they can create a new wlwmanifest.xml that goes in the root of the blog directory, Writer will then detect this file and enable the features as described in that manifest file.

To try this out, I used my test blog to change some of the settings, just simple things like the text to display to open the blog from within Writer. The results looked like this:

As you can see, I have just replaced Blog with Ferret. Of course, there are a whole host of settings that can be enabled and changed, all of which are documented on MSDN. The XML file that I used for this is as follows:

<?xml version="1.0" encoding="utf-8" ?> 
<manifest xmlns="http://schemas.microsoft.com/wlw/manifest/weblog">
<options>
    <clientType>Metaweblog</clientType>
    <supportsNewCategories>Yes</supportsNewCategories>
    <supportsTrackbacks>No</supportsTrackbacks>
    <supportsEmbeds>Yes</supportsEmbeds>
</options>
<weblog>
    <serviceName>Ferret Blogger</serviceName>   
    <homepageLinkText>View your Ferret</homepageLinkText>
    <adminLinkText>Edit your space</adminLinkText> 
</weblog>
</manifest>

There is a great, real usage of this that Scott Hanselman has made for a newer daily build of dasBlog, where he shows some of the changes you can make, like including your own buttons.

One of the other new changes in Writer is the deployment methods for plugins. There are now two additional methods other than hard coding the installer to put it in %ProgramFiles%\Windows Live Writer\Plugins. The new installer creates a registry entry for the InstalDir which the installer can get the install directory from, and then work it from there. Or you can put your plugin in a directory of your choice, and install a registry key to tell Writer where the plugin is located. This latter method is actually the one my own plugins will now be using, the new installers for those will be rolling out soon.

Now, the hidden extra that I mention, is actually something that is in the plugin APIs, and has actually been there the whole time; the difference being, up until now, it didn’t do anything. If we go back to my original tutorial, we had this for the CreateContent method that we override:

public override DialogResult CreateContent(IWin32Window dialogOwner, ref string newContent)
        {

Well in this method we get passed a string reference called newContent, which, with the release of beta 2 of Writer, now actually does something. If you highlight any text within the editor and click on a plugin, then the plugin will receive the full HTML code for the highlighted text, which you can then use in your plugin. This can be seen in use in my I’m Feeling Lucky plugin.

Note: I should mention that the newContent trick is only for simple plugins, not for SmartSource ones.

SL

45 Comments