Geocaching.com LOC Link

By JRI Last update Oct 18, 2011 — Installed 341 times.

.loc file extension problem

in
Subscribe to .loc file extension problem 2 posts, 2 voices



BargeeMark User

Hi,
This is a cool script abd just what I want. Just one small issue that I cannot fix. When clicking on the new "LOC" link the xml file downloads to my HD as expected but with an extension of "xxxxxx.loc.part" where "xxxxx" appears to be a random generation of characters.

1. Is there a way to get the file name to be the reference of the geocache
2. How to prevent ".part" from being appended to the file name

FF 3.0.5
GM 0.8.20080609.0
XP Pro

 
JRI Script's Author

Hi Mark,

I am now having exactly the same problem.

Unfortunately, I don't think that there is an easy way to set the filename. The data: URI protocol doesn't give any means of specifying the filename, and as far as I know, Greasemonkey scripts aren't allowed to access the local file system directly, for security reasons. To fix this properly you'd probably need to write a full Firefox extension, rather than just a user script.

I think that the .part extension is due to some change in Firefox, rather than a problem with Greasemonkey or the userscript. In earlier versions Firefox used to save the file OK with a .loc extension, albeit with a random filename. It now seems a little inconsistent, using .loc.part if you try to save the file, or .loc.part.loc if you open it with another program.

A partial workaround is to use a batch file to process the .loc file. Use Notepad to create a batch file with the code below, and save it as something like SaveLoc.bat.

@copy %1 "%USERPROFILE%\My Documents\Downloads\geocaching.loc"

Obviously you can change the path to match your own system. Now, when Firefox asks you what to do with the file, select "Other" from the "Open with" pulldown, then browse to the batch file you've just created. The batch file will then rename the .loc file for you, and move it somewhere helpful.

You can extend this idea, e.g. there are various helper applications that you could use to make the batch file prompt you for the filename. I use a similar batch file this way with gpsbabel to automatically convert .loc files to Nokia LMX format, before bluetoothing them to my phone.

Cross
Presentational HTML allowed.
Use <code> for inline code and <pre> for code blocks. Use &lt; and &gt; for literal < and >.
We help break paragraphs and link your links.
or cancel