Tue, 31 Jan 2006 20:52:00 GMT
In order to make my Active Desktop actually useful for shortcuts and functions that I commonly do, I wrote a little utility which translates the URL Protocol invocation created by clicking on an HREF in an HTML file.
And you have these entries in your registry (cut and paste into a reg file and merge it):
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\ssh]
@="URL:SSH Protocol"
"URL Protocol"=""
"EditFlags"=dword:00000002
"BrowserFlags"=dword:00000008
[HKEY_CLASSES_ROOT\ssh\DefaultIcon]
@="%SystemRoot%\\system32\\url.dll,0"
[HKEY_CLASSES_ROOT\ssh\shell]
@="open"
[HKEY_CLASSES_ROOT\ssh\shell\open]
[HKEY_CLASSES_ROOT\ssh\shell\open\command]
@="C:\\bin\\launchurl.exe \"%1\""
This will invoke the utility I wrote which will then access the following registry keys (also cut, paste into a reg file and merge):
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\URL Protocol Launcher]
"ssh"="C:\\PROGRA~1\\Putty\\putty.exe -load \"%1\""
"cmdshell"="C:\\bat\\shell.cmd \"%1\""
"ue"="\"C:\\Program Files\\UltraEdit\\uedit32.exe\" \"%1\""
"google"="C:\\PROGRA~1\\MOZILL~1\\FIREFOX.EXE -url \"http://www.google.com/search?q=%1\""
"vnc"="\"C:\\Program Files\\TightVNC\\vncviewer.exe\" -compresslevel 5 -quality 5 %1"
These keys define the actual program to call with all the proper command line switches and it supports a single variable replacement.
You have your active desktop HTML with a link in it like this:
<a target="_top" href="ssh:somehost">Somehost (SSH)</a>
Which invokes:
"C:\bin\launchurl.exe ssh:somehost"
which will then in turn launch
"C:\PROGRA~1\Putty\putty -load "somehost"
And most importantly this will do all of this with no popups from explorer, complaining that it can't find the proper file! This method is completely extensible to any protocol. You just need to add it like I added ssh: above.
Here's the zip file. You need to install the launchurl.exe binary somewhere and then change the paths in the reg file to match that path. Also, double check your paths in the URL Protocol Launcher key.
Mon, 30 Jan 2006 23:39:00 GMT
As I'm playing around with layout and links on my active desktop page, I'm finding that support for launching apps or content out of HTML files is...limited to put it kindly. Currently there are two ways to solve this problem.
Your choices are:
- File Type Associations via file: URL Protocol Handler
- New URL Protocol Handlers, like ssh:hostname
Both of these have problems.
File Associations: These are standard extensions to the file type model of Windows. In this method you simply put your link in your HTML file as a file: link. The system figures out which app to launch for that type and does so.
<a target="_top" href="file:C:\myfile.txt">My File</a>
With this method, you have to have a pre-existing type association for .txt files, which is very common, so you're probably good. In fact this is great for any type of content editing. If you have a file you commonly edit and a known editor, this is great. This model breaks however whenever you want a application to behave in a certain way though. Let's say that you want to open a command window in a certain directory. Well, you can't do it directly in the HTML file. You'll have to have a secondary .bat or .cmd file which does the path change and any other default actions. This is where URL Protocol Handlers come in. If you install a special URL protocol for command windows like "cmdshell:". Then you can stipulate the path that you'd like to open directly in your HTML file.
<a target="_top" href="cmdshell:C:\TEMP">CMD in C:\TEMP</a>
Cool, huh? Turns out there are a few default URL protocol handlers for windows which make life easier. They are:
- http(s): Web pages.
- ftp: FTP sites.
- gopher: Gopher Sites (if you know what that means)
- file: The standard file "open" method.
- telnet: Opens your default telnet app and connects you to the client which was the parameter.
I've since added:
- ssh:hostname - The Secure Shell connection
- cmdshell:dir - Open a command window in the provided directory.
- vnc:hostname - Open a VNC connection to the host.
- ue:file - Force an open with UltraEdit.
- google:search - Query Google with the provided term.
The problem with the URL Protocol method is that none of the programs I use to run these functions understand the
URL protocol stream invocation. See, when you invoke a URL protocol stream it's passed to the program like this (in the ssh: example):
putty.exe ssh:hostname
This won't do, of course. (Putty incidently understands telnet: but not ssh: in the version I have.) In order to solve this problem I've create a utility which is able to remove the URL Protocol type and pass the parameter on to the destination app. The next problem is that if you are using this method and create your own URL Protocol handlers, explorer.exe still wants to open them as files (probably due to some old security work around) and will complain that it can't open "ssh:hostname", even though the utility I wrote worked fine.
Now you could try to solve this problem by using file types and the file: URL and create a custom type which when launched acheives the same end goal as the URL protocol handler. This is tricky and will probably require another custom cmd file or app.
Once I have the utility running (without that dang popup) I'll post a link to the source and the registry edits you'll have to make in order for it to work.