Using the 'file://' protocol?

T

Terry Pinnell

This is a bit obscure, and maybe not even strictly an XP topic, but I
hope one of the programmers here can help please. Or point me to an
appropriate newsgroup.

One of the features of my text editor (the excellent TextPad from
Helios Software) lets me paste a URL into a document and go to it
directly on the web by r-clicking and choosing the top item, Open.

I'd like to be able to do the same for files on my HD. IOW, select
text like this:
D:\Docs\Electronics\CIRCUITS\CM\Switches\NO-Button.gif
and open that file, just as if I was doing so from a Windows XP
folder.

After some research, I found a partial solution. If I convert that
file name to this syntax (protocol?)
file://D:/Docs/Electronics/CIRCUITS/CM/Switches/NO-Button.gif
then I can open it. But it fails if there are any spaces in the path
or filename, such as
'file://D:/Docs/SUNDRY/Internet Radio/BBC stations etc.txt'

Anyone know how to get around that please? Placing it in quotes didn't
work.
 
T

Tom Porterfield

This is a bit obscure, and maybe not even strictly an XP topic, but I
hope one of the programmers here can help please. Or point me to an
appropriate newsgroup.

One of the features of my text editor (the excellent TextPad from
Helios Software) lets me paste a URL into a document and go to it
directly on the web by r-clicking and choosing the top item, Open.

I'd like to be able to do the same for files on my HD. IOW, select
text like this:
D:\Docs\Electronics\CIRCUITS\CM\Switches\NO-Button.gif
and open that file, just as if I was doing so from a Windows XP
folder.

After some research, I found a partial solution. If I convert that
file name to this syntax (protocol?)
file://D:/Docs/Electronics/CIRCUITS/CM/Switches/NO-Button.gif
then I can open it. But it fails if there are any spaces in the path
or filename, such as
'file://D:/Docs/SUNDRY/Internet Radio/BBC stations etc.txt'

Anyone know how to get around that please? Placing it in quotes didn't
work.

Try changing the space to %20 (URL encoded). Also, the correct syntax is
three / after file. Ex:

file:///D:/Docs/SUNDRY/Internet%20Radio/BBC%20stations%20etc.txt
 
J

Jon

(May need to view this message in html, not plain text, and the links won't work if you click on them for obvious security reasons)

You could also avoid the "file://" format, if it causes problems, and use links of the format

C:\Documents and Settings

C:\Program Files

Jon


This is a bit obscure, and maybe not even strictly an XP topic, but I
hope one of the programmers here can help please. Or point me to an
appropriate newsgroup.

One of the features of my text editor (the excellent TextPad from
Helios Software) lets me paste a URL into a document and go to it
directly on the web by r-clicking and choosing the top item, Open.

I'd like to be able to do the same for files on my HD. IOW, select
text like this:
D:\Docs\Electronics\CIRCUITS\CM\Switches\NO-Button.gif
and open that file, just as if I was doing so from a Windows XP
folder.

After some research, I found a partial solution. If I convert that
file name to this syntax (protocol?)
file://D:/Docs/Electronics/CIRCUITS/CM/Switches/NO-Button.gif
then I can open it. But it fails if there are any spaces in the path
or filename, such as
'file://D:/Docs/SUNDRY/Internet Radio/BBC stations etc.txt'

Anyone know how to get around that please? Placing it in quotes didn't
work.
 
J

jussij

Anyone know how to get around that please? Placing
it in quotes didn't work.

One solution would be to replace Texpad with Zeus :)

http://www.zeusedit.com/features.html

Zeus can open URL's or local files using the "View, Open
Include File" menu.

I am pretty sure this would work "out of the box", but
if it does fail to open the file correctly, it should
be possible to create a simple Zeus macro to also open
the file.

Note: Zeus is shareware (45 day trial).

Jussi Jumppanen
Author: Zeus for Windows
 
S

Stan Brown

After some research, I found a partial solution. If I convert that
file name to this syntax (protocol?)
file://D:/Docs/Electronics/CIRCUITS/CM/Switches/NO-Button.gif
then I can open it.

Nearly right. It's file://localhost/d:/path/file, but "localhost" is
implied so you type file:///d:/path/file -- three slashes, not two.
If your software actually works with two slashes, that's its own
addition to the standard form of URLs.
But it fails if there are any spaces in the path
or filename, such as
'file://D:/Docs/SUNDRY/Internet Radio/BBC stations etc.txt'

Code a space as %20. This isn't as mysterious as it looks! A space is
character 32 (hex 20), and in a URL you can code any character with a
% sign followed by its two-digit hex number. So the standard URL for
the file you describe would be
file:///D:/Docs/SUNDRY/Internet%20Radio/BBC%20stations%20etc.txt

--
Stan Brown, Oak Road Systems, Tompkins County, New York, USA
http://OakRoadSystems.com/
"To put it bluntly but fairly, anyone today who doubts that the
variety of life on this planet was produced by a process of
evolution is simply ignorant -- inexcusably ignorant, in a world
where three out of four people have learned to read and write."
--Daniel Dennett, /Darwin's Dangerous Idea/ (1995), page 46
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top