Macro to add a hyperlink to a mail message

February 13, 2008 by splintor

Today I wrote a mail to someone and wanted to add several links. It always annoyed me that Office’s Add Hyperlink is so bloated it takes sometime to open, and even more time to switch back to it from another application, where all I wanted was to make the selected text link to the URL I had in my keyboard. So I set out to write a macro that did it.

Since Outlook has no macro recorder, I started searching the Outlook Object Browser and revealed that there is no method to add a hyperlink or to get the content of the clipboard. So I borrowed the “Getting clipboard content” functionality from a VBS script I have, and I turned to Word to record a macro that adds a hyperlink to the selected text. Once I had this Word macro, I found out I can use ActiveInspector.WordEditor to issue the Word macro I created.

The final macro result is this:

Public Sub AddLinkFromClipboard()
    If ActiveInspector.EditorType = olEditorText Then
        MsgBox “Can’t add links to textual mail”
        Exit Sub
    End If
    Dim objHTM As Object
    Dim ClipboardData As String
    Dim doc As Object
    Dim sel As Object
    Set objHTM = CreateObject(”htmlfile”)
    ClipboardData = _
        objHTM.ParentWindow.ClipboardData.GetData(”text”)
    Set doc = ActiveInspector.WordEditor
    Set sel = doc.Application.Selection
    doc.Hyperlinks.Add Anchor:=sel.Range, _
                       Address:=ClipboardData, _
                       SubAddress:=”", _
                       ScreenTip:=”", _
                       TextToDisplay:=sel.Text
End Sub

Xobni feedback: Missing tooltips

January 16, 2008 by splintor

In various areas in the sidebar, when there is not enough space for a string, ellipsis is used, but when I hover over it with my mouse, I expect to see a tooltip showing me the entire string, so I don’t have to make room for it to see what the string is. This is common UI pattern, which is missing in Xobni.

Sample for such problems can be see in panes titles (such as “People connected to…”, “Conversation with…”), messages subjects and some more.

Xobni makes excessive use of “what’s this” tooltips at the upper part of the sidebar, explaining each of the items, and also when the links for a person (”schedule time with…”, “e-mail…”) are truncated in a narrow sidebar, the tooltip shows their full text, but that’s less important. The count in the end of a pane title, or a message’s full subject is much more important, and for this, Xobni fail to show tooltips.

Xobni feedback: Limited contact information

January 16, 2008 by splintor

Xobni will only let you store one phone number per person. But what if someone has a work number, home number and a cell phone, and you decide what to use based of his daily schedule and the time of the day?

It would be very convenient to be able to assign several number to a person, and then, when this person is displayed in the Xobni side bar, all his numbers would be displayed, and you could choose what to use.

Another problem with person contact is that when you edit it and add a number, you loose the information Xobni collected from e-mails, so if you added a picture for a person, or mistakenly set a phone number for him, you have no way to ask Xobni to use the person contact details it gathered from e-mails.

There should be an option to tell Xobni to revert back to use data from e-mails, and also there should be a way to edit this information or to add data like picture without affecting this information.

Xobni feedback: Missing right-click menus

January 16, 2008 by splintor

Although they bragged about adding right-click menu to the sidebar, I still miss having all the options from the relevant Outlook menu when I right click a message, a contact or an attachment.

For example -

  • If I see an attachment in the Xobni bottom panel, I’d like to be able to save it to a file.
  • If I see someone name in the people pane, I’d like to be able to open it’s related Outlook contact.
  • If I see a message I’d like to be able to move it to a different folder (and also to know what folder it is currently in, but this is something for a separate post…)

Xobni feedback: Almost no options at all

January 16, 2008 by splintor

It looks like Xobni is following Google in many ways. The recent Gmail-like invitation is an obvious example.

The problem is that they also follow Google line of “we know better than you how our software should behave, so we won’t let you configure anything” (I already ranted about it here and there).

So currently, Xobni doesn’t let you control what PST or folders will be indexed, and what times index should not work as you want your Outlook to be more responsive, etc.

It also doesn’t show you the current index status, so you don’t know if it finished going over all your mail, and I’m still not fully convinced about it’s search capabilities, and when I want to find something in my e-mail for sure, I still turn to X1. X1 also enables me to have advanced search such as all the e-mails sent by me which have “Xobni” in their subject. This can many times come handy, where just searching for “Xobni” isn’t good enough, as it brings too many results.

Xobni can really use an Advanced Search option

Xobni feedback: Tooltips for hidden text

January 15, 2008 by splintor

Well, here is my first post in a series of Xobni feedbacks. They have no meaningful order - it’s just the way I found them and had the time to put them as a post.

The Xobni sidebar puts data in categories. These categories’ titles can be partially hidden if the sidebar is too narrow. It would be nice if hovering over the title would show the entire title text in tooltip like one would expect, e.g. like it is in Outlook folder tree or messages list. When a text is not fully displayed, hovering over it should show a tooltip.

This will enable me to easily see how many people Xobni sees as related to someone, without having to widen the Xobni sidebar to see the entire title of the “People Connected” section.

Currently, it seems tooltips are only used in Xobni to explain some fields in the person details area.

New tools

January 15, 2008 by splintor

I recently came by several new neat tools:

del.icio.us Bookmarks (Firefox extension)

Evgeny asked me if I know of a way to synchronize his browser’s hierarchal bookmarks with his Google tagged bookmarks. I recommended him switching to del.icio.us, knowing that such a popular site must have a synchronizing extension. A little search revealed that after Yahoo purchased del.icio.us, they wrote a extension to do exactly what I looked for, and it seems to work extremely well.

One of the main benefits of the extension to me is the option to bookmark an opened Firefox tab while offline, counting on the extension to later synchronize it to del.icio.us when I’m back online.

The only problem is that I have used many, many tags, and this translates to a very long Tags menu. Obviously, the guys at Yahoo thought about it, and added the Favorite Tags feature, but still, if I look for a tag not in my favorites list, it can be annoying. I really need to clean up my list of bookmarks, but that’s not related to the del.icio.us Bookmarks. It would be better, though, if they could put the list of tabs in multiple-columns menu, like the programs menu in Windows’ Start menu, but I don’t know how easy it is to do it in a Firefox extension.

Miranda IM

When I first realized I use several IM clients, and could use one tool that will aggregate them all, I started using Meebo, especially as I was impressed with the Web and AJAX abilities they demonstrated. But then I realized I prefer a non-browser solution, which will not depend on my browser (which is an important working tool for me), and will show me tray notification on events. I picked Pidgin which looked nice.

But recently  I realized I’m having too many problems with it. It didn’t do Hebrew spell checking, it often got stuck while writing messages, it didn’t display Hebrew properly with talking with my boss via MSN, and some more. I started looking again, and found Miranda. Miranda look very nice, and it seem to have a plugin for anything I could think I need. I especially liked the SMS plugin which sends SMS via ICQ for free I so liked it, I recommended it to friends, and even installed it on my wife’s machine, so she can use it for sending SMS (thought she is still using Google Talk for chatting).

The only current problem is that Miranda doesn’t handle Hebrew spell checking well as well. I posted something about it. I hope it will sometime be fixed.

Xobni

When I saw the Xobni video I fell in love and signed up to their closed beta. I recently got an invitation to the beta and started using it. Surprisingly, It doesn’t slow down my Outlook and seems to work very well. I do have some complaints, but because it is too long, I’ll post them in separate posts.

Fireshot (Firefox extension)

I don’t use Nitobi’s products, but after reading Alex’s explanation of how he built the FishEye widget, I subscribed to his blog which sometimes have interesting ideas or links. He recently posted about the Fireshot Firefox extension for taking screenshots from the browser. There are many screen capturing programs, and my favorite is  MWSnap, but his extension allows you to easily edit the captured image - crop and blur areas, add annotations etc. I even used it to open an image captured outside of the browser with MWSnap, by opening the image in Firefox and re-capturing it, just for the editing.

The only problem I’m currently having with it doesn’t have an Undo feature, which means that if you made a mistake in your editing of the captured image, you have to re-capture and start all over again.

Wish: AutoComplete add-in for Word that suggests words from current document

June 20, 2007 by splintor

UltraEdit has a nice feature in which when you press Ctrl-Space, an auto-complete list is opened, suggesting you to complete the word you just started to type. The nice thing is that its suggestions come not only from the list of keywords of the edited file’s language, but also from the actual words in the file (actually, the words above you current location).

This is great as you often use the same words several times in a file, and it can be handy for your editing tool to use that and suggest options from your current work, which probably knows the words in the domain more then any general keywords dictionary file.

I really wish someone would have written an add-in to Microsoft Word that does it. I might get to it some time when I have time (as if… ha).

Javascript: Function.prototype.toString returns an optimized version of the function

June 17, 2007 by splintor

I was working an a user script for Gmail (I’ll link to it when it’s done), and could not understand what some code didn’t run on a specific page.

One of my tricks of seeing a Javascript function body when the function is dynamically added is to call the function toString() (e.g. in Firebug console). Regretfully, Firebug doesn’t tab-complete functions’ methods, so I have to manually type “toString()”.

However, in the code I wrote, I accidentally wrote something like:

var count = getCount();

if(count == 0)

count == 1;

Note the bug in the last line, where the comparison operator (==) is used instead of the assignment operator (=). Surely, my mistake. However, when I look at the text that was returned from the call to Function.prototype.toString() for that function, I saw it is:

var count = getCount();

if (count == 0) {

}

So the Javascript engine noticed that nothing really useful is going on in the body of that if, and simply removed it, and that is reflected in what Function.prototype.toString returns. I didn’t knew that.

PS

Naturally tools like JSLint warn about this problem:

Expected an assignment or function call and instead saw an expression.

count == 1;

But this is a minor user script, and I never considered passing such scripts through JSLint. I might consider starting doing it for my scripts…

A solution to quickly moving mail items from Outlook inbox

June 12, 2007 by splintor

My usual way of handling e-mails is reading them in the inbox which collects both work-related e-mails from the Exchange server and private e-mails from my Gmail inbox using SMTP and POP3., and then dragging them to the the appropriate folder in one of the PST I have.

I know that since I index my mails and it is lightning fast to find any e-mail filing each e-mail in a specific related folder is less important, but kind of used to it, and I still find it useful to be able to go to a folder and see all the mails that I decided that belong to that folder, and not all the files that match some search. This has prove itself useful mainly in customer related data, where searching the customer name would have bring way too many mails, but looking at the customer folder quickly revealed the old case I was looking for. By the way, these is one of the reason I prefer Outlook to Gmail. Outlook can easily help me categorize my mails in hundreds of hierarchical folders, where Gmail provides a flat list of labels, which might not be useful for more than a few dozens.

My problem was that whenever I wanted to move a mail to a folder, I would have to find the folder in the folders tree, in order to drag the mail into it. This might be annoying for commonly used  folders like the folder that keeps mails from CodeProject (I’m subscribed to it although I rarely develop in Microsoft technologies. I enjoy skimming through it looking at what’s new in that area. Occasionally I even find an interesting article).

When a mail is opened in Outlook editor, which has the new ribbon, the ribbon has a clever Move to Folder item which opens a list of recently used folders. However, if I don’t want to open the mail, and only want to move it to a folder from the index, I have to find the folder in the tree and drag it to it.

One solution is to use the Favorite Folders to put shortcut to commonly used folders in a fixed place, and then drag mails to that folder shortcut, and not to its location in the tree. This has two drawbacks:

  1. The list tends to grow all the time, and I end up with a big list of “Favorite Folders” which I rarely ever navigate to - I only use them as drag targets.
  2. Sometimes Outlook crashes and the list of Favorites folder is reset, and I have to start building it from scratch.

Today I came up with a new solution - use macros.

I wrote the following VBA procedure:

Private Sub MoveItemsToFolder(folderID As String)
    Dim item As MailItem
    Dim targetFolder As Folder
    ‘ Folder ID can be obtained by selecting the folder
    ‘ in Outlook and then typing in the immediate window:
    ‘   ?ActiveExplorer.CurrentFolder.EntryID
    Set targetFolder = GetNamespace(”MAPI”) _
                        .GetFolderFromID(folderID)
    If ActiveExplorer.CurrentFolder = targetFolder Then
        MsgBox “You are already in ‘” & targetFolder.Name _
                  & “‘.”, vbCritical
        Exit Sub
    End If

    For Each item In ActiveExplorer.Selection
        item.Move targetFolder
    Next item
End Sub

and then I wrote small procedures like the following:

Sub MoveToPrivate()
    MoveItemsToFolder _
“0000000045DC3C0FFF1EA54CBAD9147BB26AF269A2800000″
End Sub

Sub MoveToCodeProject()
    MoveItemsToFolder _
“00000000A7E4D138E838B7489BA3F839949B055122860000″
End Sub

Then I created a new menu in Outlook toolbar, and added these procedures as items to this toolbar menu. So now, when I want to move a mail to a folder, I simply select it and click the appropriate button.

As the comment says, if a new folder is needed, I select it and open the VBA editor, and type

ActiveExplorer.CurrentFolder.EntryID

 in the immediate window. I didn’t have an Outlook crash yet, so I don’t yet know if crashes that reset the favorite folders also reset toolbar customization, but at least the first problem is solved - my favorite folders only contains folder I navigate to regularly, and not all the folder I periodically get mails that should be filed under them.