Firefox Open Containing Folder (Reveal Download with TC)

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Firefox Open Containing Folder (Reveal Download with TC)

Post by *Zweikeks »

Hi Folks,

I am using Firefox and Total Commander (Windows 7). I am searching for a way to reveal the downloaded file directly with Total Commander - instead of fiddling around first with the Windows Explorer.

The download location and file is revealed when you press CTRL+J in Firefox, open the context menu of the download and then click on Open Containing Folder. Upon this the Windows Explorer opens. Is there any way to open the Total Commander instead?

I stumbled over this a few times. It keeps bothering especially the Linux community for several years now.

The attempts I found to solve it are:
1) Adding Total Commander to the context menu of folders. This could be extended to the context menu of files. First Windows Explorer would open and from there you would have to open Total Commander.
http://www.ghisler.ch/wiki/index.php/Explorer_integration
2) Simply configuring Firefox. This has been reported to not work anymore. I tried it. Did'nt work for me either.
http://rubylution.ping.de/articles/2007/09/11/open-containing-folder-in-firefox-under-linux
3) Hacking the Firefox sources. This actually seems to work for me. I had a look at the sources, did some first tests. The drawback is that it'll break frequently every time Firefox updates.
http://twoday.tuwien.ac.at/pub/stories/316660

Does someone know about a solution I did'nt find? I will try to go with number 3) but I am still hoping that all this is not necessary.

Thanks
Last edited by Zweikeks on 2010-12-02, 04:19 UTC, edited 1 time in total.
User avatar
nsp
Power Member
Power Member
Posts: 1803
Joined: 2005-12-04, 08:39 UTC
Location: Lyon (FRANCE)
Contact:

Re: Firefox Open Containing Folder (Reveal Download with TC)

Post by *nsp »

Zweikeks wrote: Does someone know about a solution I did'nt find? I will try to go with number 3) but I am still hoping that all this is not necessary.

Thanks
This is not a solution but a guess..

An alternate way is to get inside TC a list of FF downloaded files. And use TC to go to those files/folder.

You can builds such list using sqlite3.exe from downloads.sqlite file inside your firefox profile. using a sql request like "select substr(target,9) from moz_downloads where state = 1;"
Integrated to Virtual Panel with an update script you can get all downloaded file in a virtual folder with autoload script.
Inside Virtual Panel,
A) create a folder \prog where you link with a batch file doffdown.cmd like

Code: Select all

sqlite3.exe -noheader "Z:\PathTo\FFProfile\downloads.sqlite" "select substr(target,9) from moz_downloads where state = 1;" >"%TEMP%\ffdown.lst" 
B) create a folder "FF Downloads"
C) create an autoload script inside FF Downloads

Code: Select all

<del /f *.* <exec /w \prog\doffdown.cmd <silent <put /l . %TEMP%\ffdown.lst
Adapt it if you want to get a try... you can open file directly from the virtual folder or use Ctrl -> or ctrl <- to have the file in the opposite panel.
damjang
Senior Member
Senior Member
Posts: 215
Joined: 2003-10-09, 15:58 UTC
Contact:

Post by *damjang »

I suggest to use firefox Download Manager Tweak extension
http://dmextension.mozdev.org/ . Then you can see upper in the download window/tab the path where the file was downloaded. I copy the path, go in TotalComamnder and write in TC commnad_line "cd ", paste the path and press enter.
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Post by *Zweikeks »

@nsp:
Good idea to extract the download list with sqlite. Let me see if I get this running.

@damjang:
Yes, ok, avoids opening an extra explorer window. But still, it needs a copy&paste. I was hoping for something more convenient. Unfortunately the plugin does not allow to configure an external file manager either.
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Post by *Zweikeks »

Hi,

I got the downloads list in Virtual Panel mostly working. There are still some odds and ends. For example spaces are handed over as %20 from Firefox. But I picked up the concept. Thanks for the code.

Nice is that it does not break that easily if Firefox gets updated. And I can manipulate the files directly with Total Commander. However, I did not see how I can jump from there to the real folder containing the file.
And not all Total Commander functionality is present. For example a click on a .zip opens Windows Explorer.

So I still prefer to be able to do an 'Open Containing Folder' in the Downloads list of Firefox. In an optimal way Total Commander opens the folder in a new tab and the selector is on the downloaded file.
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Post by *Zweikeks »

Hi again,

I have solution 3) working now. Here is the source and the binary:
http://www.sixo.de/EXCHANGE/ff_tc_jumppad_v10.zip
The installation is described in the source.

I wanted to do only minimal changes to Firefox. And I wanted to have something in the middle between Firefox and Total Commander to see what's going on. So I implemented a little C program doing the conversion from file URLs to local paths.

A first attempt was to use the Win API, but in Windows the URL stuff is just insane. The PathCreateFromUrl is not handling the URLs from Firefox correctly anyway. By copying the code, tailoring it and making some fixes, I got a small, compact program that can be easily compiled in whatever environment without a bulky lib.

Luckily Firefox can be changed without recompiling. The code for the Downloads list is in JavaScript. In the current release 3.6.12 of Firefox the function of Firefox to change is:

Code: Select all

function showDownload(aDownload)
{
  var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));

  try {
    // Show the directory containing the file and select the file
    f.reveal();
  } catch (e) {
    // If reveal fails for some reason (e.g., it's not implemented on unix or
    // the file doesn't exist), try using the parent if we have it.
    let parent = f.parent.QueryInterface(Ci.nsILocalFile);
    if (!parent)
      return;

    try {
      // "Double click" the parent directory to show where the file should be
      parent.launch();
    } catch (e) {
      // If launch also fails (probably because it's not implemented), let the
      // OS handler try to open the parent
      openExternal(parent);
    }
  }
} 
What ff_tc_jumppad needs is simply:

Code: Select all

function showDownload(aDownload)
{
  var f = getLocalFileFromNativePathOrUrl(aDownload.getAttribute("file"));

  openExternal(f);
 }
Any changes beyond that are done by running Firefox and doing a few clicks.

ff_tc_jumppad is controlled with environment variables. The file manager executable and the parameters to hand over can be set. Usually it does not open a window. Only in case of errors, or with the environment variable FF_TC_DBG = 1, message boxes are telling you what's going on.

I tested Win2K, WinXP 32bit, Win7 64bit, Firefox 3.6.12, Total Commander 6.53 (Win2K) and 7.55a.
Version 6.53 is not placing the selector on the file whereas 7.55a does.

Have fun with it :-)
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Post by *Zweikeks »

Firefox Total Commander Jumppad

Enables to launch Total Commander with 'Open Containing Folder' from the Firefox Downloads list.
Takes a URL from Firefox, converts it to a local path and starts Total Commander.

http://www.sixo.de/EXCHANGE/ff_tc_jumppad_v10.zip

Installation:
- Open the archive toolkit.jar under chrome in the Firefox program directory.

- Extract downloads.js.

- In the function showDownload uncomment the whole function code, only the var statement is left. Add openExternal(f); under the var statement.

- Repack downloads.js into toolkit.jar. Note that this change will be overwritten each time Firefox updates.

- Start Firefox. Open the downloads list (STRG+J). In the context menu of an item select 'Open Containing Folder'.

- In the window that opens choose ff_tc_jumppad.exe as the application. Select 'Remember my choice'. Firefox is automatically changing mimeTypes.rdf in your profile.

- ff_tc_jumppad opens saying that an environment variable needs to be configured. Just click ok for now.

- At least set FF_TC_EXEC in the environment (Control Panel). This is the path to the Total Commander executable.

- Optionally set FF_TC_PARA to the parameters you want to be handed over to Total Commander.

- Optionally set FF_TC_DBUG = 1 to always get a debug message from ff_tc_jumppad.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Maybe it would be better to create some Firefox addon that will allow to start TC with downloaded file path?


BTW you can use Ctrl+Left/Ctrl+Right or Shift+Enter to jump to file from Virtual Panel (if you're using it).

And you can use any console text replacer to replace %20 with spaces in list before loading it to virtual panel.
Zweikeks
Junior Member
Junior Member
Posts: 6
Joined: 2010-11-29, 07:12 UTC

Post by *Zweikeks »

Yes, good idea. Should be possible. Writing an extension is not that hard. However, I am not a pro with this Browser, JavaScript, xul stuff.
I had a glance. There is a lot example code and tools. But I haven't seen how to debug. Is it possible somehow to step through the code?
Many extension hook up with <menupopup> to the menu system of Firefox. Can this be done also for the context menu of the Downloads list?
And where to get the URL/filename from?
I think these types of questions are better off in a Firefox forum.

Anybody out there interested in getting this done? For me my approach works. I would not spent more time on it. If there are some people interested (perhaps someone more experienced), it would be fun to dive a bit into the extension stuff.
User avatar
MVV
Power Member
Power Member
Posts: 8702
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Sorry I'm not familiar with FF extensions and FF at all (I'm Opera user :) - Opera shows system context menu for downloaded files so it is possible to register jump to TC command in system registry and use it there).
trismarck
Junior Member
Junior Member
Posts: 13
Joined: 2010-09-06, 21:09 UTC

Post by *trismarck »

I've followed the procedure and it works.
My config:
* Windows XP SP3
* Firefox 3.6.12
* Download Manager Tweak 0.9.2
I had to modify the extension sources (in a similar way) to get this to work.
I can post a .zip file with the log if you want but there seems to be no 'upload files' option for the forum? Write me an email if you want it.
Terka
Senior Member
Senior Member
Posts: 326
Joined: 2006-05-24, 09:04 UTC

Re: Firefox Open Containing Folder (Reveal Download with TC)

Post by *Terka »

Hi, how do this to work in win10?
User avatar
vdijken
Member
Member
Posts: 181
Joined: 2016-07-30, 14:07 UTC
Location: The Netherlands

Re: Firefox Open Containing Folder (Reveal Download with TC)

Post by *vdijken »

Assign a program to extensions. E.g. when I click in Firefox on a downloaded PDF file Acrobat Reader opens. I also added the download directory to my TC favourites (Ctrl-D).
Post Reply