Chrome - Show in folder

Features wanted...
Post Reply
Exolon
Posts: 15
Joined: 11 Apr 2011 11:11

Chrome - Show in folder

Post by Exolon »

Hi,

XY is set as my default file manager. If I now click on "Show in folder" in the Chrome Downloads Tab the system switches correctly to XY and XY shows the download folder. Unfortunately the file downloaded is not set as current selected item, it is always the first element in the tab selected.

Is it possible to automatically go to the downloaded file as Windows Explorer would do?

Thanks

Exo

admin
Site Admin
Posts: 60622
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Chrome - Show in folder

Post by admin »

Probably not. I'm not sure which technique Explorer uses to do this.

nas8e9
Posts: 2232
Joined: 21 Jun 2008 14:50

Re: Chrome - Show in folder

Post by nas8e9 »

admin wrote:Probably not. I'm not sure which technique Explorer uses to do this.
Chrome seems to somehow call the DCom Server Process Launcher Service (DcomLaunch) hosted in a generic services.exe-process which in turn calls Windows Explorer with a command line like so:

Code: Select all

C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding
(No, I don't know what that means and yes, I was bored. :))

admin
Site Admin
Posts: 60622
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Chrome - Show in folder

Post by admin »

nas8e9 wrote:
admin wrote:Probably not. I'm not sure which technique Explorer uses to do this.
Chrome seems to somehow call the DCom Server Process Launcher Service (DcomLaunch) hosted in a generic services.exe-process which in turn calls Windows Explorer with a command line like so:

Code: Select all

C:\Windows\explorer.exe /factory,{ceff45ee-c862-41de-aee2-a022c81eda92} -Embedding
(No, I don't know what that means and yes, I was bored. :))
:)

@Exolon: Menu Help / Various Information (in XYplorer) gives you the command line this instance of XYplorer was called with. Can you copy/paste this info into this thread please?

Exolon
Posts: 15
Joined: 11 Apr 2011 11:11

Re: Chrome - Show in folder

Post by Exolon »

Hmm, there is no filename in the string:

Command: "F:\Downloads"
CommandW: "F:\Downloads"
Command Normalized: "F:\Downloads\"

Exolon
Posts: 15
Joined: 11 Apr 2011 11:11

Re: Chrome - Show in folder

Post by Exolon »

O.k. I (tried) to check the Chrome code to check what happened (and why the Command line omits the filename):

The default case is to open and select the file via the API, if this fails (like in case with XY) it simply shows the folder:

Code: Select all

  typedef HRESULT (WINAPI *SHOpenFolderAndSelectItemsFuncPtr)(
      PCIDLIST_ABSOLUTE pidl_Folder,
      UINT cidl,
      PCUITEMID_CHILD_ARRAY pidls,
      DWORD flags);

  static SHOpenFolderAndSelectItemsFuncPtr open_folder_and_select_itemsPtr =
    NULL;
  static bool initialize_open_folder_proc = true;
  if (initialize_open_folder_proc) {
    initialize_open_folder_proc = false;
    // The SHOpenFolderAndSelectItems API is exposed by shell32 version 6
    // and does not exist in Win2K. We attempt to retrieve this function export
    // from shell32 and if it does not exist, we just invoke ShellExecute to
    // open the folder thus losing the functionality to select the item in
    // the process.
    HMODULE shell32_base = GetModuleHandle(L"shell32.dll");
    if (!shell32_base) {
      NOTREACHED() << " " << __FUNCTION__ << "(): Can't open shell32.dll";
      return;
    }
    open_folder_and_select_itemsPtr =
        reinterpret_cast<SHOpenFolderAndSelectItemsFuncPtr>
            (GetProcAddress(shell32_base, "SHOpenFolderAndSelectItems"));
  }
  if (!open_folder_and_select_itemsPtr) {
    ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
    return;
  }

  base::win::ScopedComPtr<IShellFolder> desktop;
  HRESULT hr = SHGetDesktopFolder(desktop.Receive());
  if (FAILED(hr))
    return;

[SNIP]

  hr = (*open_folder_and_select_itemsPtr)(dir_item, arraysize(highlight),
                                          highlight, NULL);

  if (FAILED(hr)) {
    // On some systems, the above call mysteriously fails with "file not
    // found" even though the file is there.  In these cases, ShellExecute()
    // seems to work as a fallback (although it won't select the file).
    if (hr == ERROR_FILE_NOT_FOUND) {
      ShellExecute(NULL, L"open", dir.value().c_str(), NULL, NULL, SW_SHOW);
    } else {
      LPTSTR message = NULL;
      DWORD message_length = FormatMessage(
          FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM,
          0, hr, 0, reinterpret_cast<LPTSTR>(&message), 0, NULL);
      LOG(WARNING) << " " << __FUNCTION__
                   << "(): Can't open full_path = \""
                   << full_path.value() << "\""
                   << " hr = " << hr
                   << " " << reinterpret_cast<LPTSTR>(&message);
      if (message)
        LocalFree(message);
    }
  }
Does this help in any way?

Exolon
Posts: 15
Joined: 11 Apr 2011 11:11

Re: Chrome - Show in folder

Post by Exolon »

... here is the corresponding Log Message:

[4428:4688:6897787:WARNING:platform_util_win.cc(99)] platform_util::ShowItemInFolder(): Can't open full_path = "F:\Downloads\Mercurial-2.0.exe" hr = -2147467260 躈E

admin
Site Admin
Posts: 60622
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Chrome - Show in folder

Post by admin »

Thanks, but XYplorer only seems to receive "F:\Downloads" from Windows. No chance.

gks
Posts: 14
Joined: 29 Apr 2014 09:03

Re: Chrome - Show in folder

Post by gks »

Much water has flown down the Thames since the last post, in this thread,

But do we have some workaround for it, as 'For ONLY UNAIDED-EYES without the blue strip on the file' it seems really hard to correctly pin-point at the required file in a huge collection of downloaded items

Theodecarvalho
Posts: 49
Joined: 17 Jul 2022 11:59

Re: Chrome - Show in folder

Post by Theodecarvalho »

Hi. I searched for this problem and get me to here.

It is solved? When I select in my chrome: Show folder, XYplorer always opens with first file, not the last one that I downloaded.

admin
Site Admin
Posts: 60622
Joined: 22 May 2004 16:48
Location: Win8.1 @100%, Win10 @100%
Contact:

Re: Chrome - Show in folder

Post by admin »

Not fixable.

Post Reply