Invoke a bug tracking application (part 2)

Now that I have this great application that can open a bug report just by me sending the bug report number as a parameter, I can do some pretty powerful stuff. I can thank John Nelson for coming up with this part of the solution.

This is a solution to the problem of having an executable to do all this isn't that useful. I need a quick way to be able to invoke the executable's functionality. I can't just depend on people using Launchy.

The answer is a URI Protocol.

If you are not familiar with them, think of a mailto link. Your OS just knows how to handle clicking on a mailto link because it knows what your configured default mail client is. Now I can tell the OS what my default bug tracking application is. You would think this requires some level of application level code or something like that but it's simpler than that. You just need to tell the OS that you want to register a protocol with it in the dreaded registry. You can do this with a straight .reg file or you can do it the way John and I did in the setup project for the application that invokes the bug tracking software.

This setup project is no different than your average Add new project > Other Project Types > Setup Project. You can right click the project and view the registry keys associated with the installer and add your own. The real key is knowing where to put it.

My work machine uses Win XP. I know, it's so retro! On XP the protocols are defined under the root of HKEYCLASSESROOT. On my home machine running Windows 7 the protocols are under HKEYCLASSESROOT\PROTOCOLS\Handler. If you are interested, you can see all the other protocols that are registered there too. Even the mailto protocol we all know about. From the rest of the protocols you can see that the colon in the protocol is implied. In my case I want to create a protocol named "issue" so that I can write out "issue:12345" and the OS will know I want to call my default bug tracking software by saying "issue:" and I want to open this bug report "12345". To do this I create a folder in this location called "issue" as well as a few others.

In the Command folder you will need to specify a default key with the data of:

"[TARGETDIR]\BugReportInvoker.exe" "%1"

The installer will fill in the [TARGETDIR] with the executable path. So this is telling the OS that when you use "issue:" call this application and pass it the parameter of whatever is after "issue:". Pretty clever, I know!

All of a sudden this simple, crappy little application that opens a bug report has more uses. I can go to start > run and type in "issue:12345" and bug report number 12345 opens right up. I can go into an email and create hyperlinks to bug reports by simply typing my new protocol and the bug report number. Now I feel like my application has full exposure. Wherever I want to invoke a bug report, I can do it!

Now all I have left with this project is making it easy to use. As if it were transparent to anyone want to use it or wanting to embed a link into some text. That's the challenging part, right? The user friendly aspect of it? My first hurdle is Office. That's where it's really useful, is embedding links into things like a development schedule. So I can see in a schedule that I will be working on a bug and I know the number, it's right there, so I want to click it to open it. Office gets upset and wants to warn about the potential risk of opening a link. Come on, I'm an adult. I don't get a warning every time I click a link in a web browser so why start now! My coworkers were annoyed by this message popping up and asked if I could do anything about it. I googled my way out of it and found these steps:

  1. Click Start, and then click Run.
  2. In the Open dialog box, type regedit, and then click OK.
  3. In Registry Editor, locate one of the following registry subkeys: HKEYCURRENTUSER\Software\Microsoft\Office\12.0\Common or HKEYCURRENTUSER\Software\Policies\Microsoft\Office\12.0\Common Note: You only have to modify one of these registry subkeys. You do not have to modify both of them.
  4. Right click the registry subkey, point to New on the Edit menu, and then click Key.
  5. Type Security, and then press ENTER to name the key.
  6. On the Edit menu, point to New, and then click DWORD Value.
  7. Type DisableHyperlinkWarning, and then press ENTER to name the entry.
  8. In the right pane, right-click DisableHyperlinkWarning, and then click Modify.
  9. In the Edit DWORD Value dialog box, click Decimal, and then type 1 under Value data.

Some people are weirded out by taking warnings like that out so I did not include it in the installer and I didn't add an option in the installer because I am lazy.

Removing the warning has made several people happy and certainly not a complaint I thought I would hear. Like I said, the user friendly part of it is the hardest part. Who would have thought I would be having user friendly issues in a non GUI application where the user has literally no interaction with the application.

Recently I have had another complaint. The complaint is that when writing a document in Microsoft Word it is too much work to create hyperlinks every time I want to have a bug report link. You might be thinking, "really? Too much work?" but, yes. I totally agree. a productivity tool should be oozing with productivity! If it is not, then what good is it?

Part three will talk about how I addressed it and it might just be my favorite step yet (I get to write code).