Skip to content

Folder detection fails for explorer tabs when using hotkey #108

Description

@eltos

When using PasteIntoFile in tray mode and pressing the WIN+ALT+V Hotkey, a heuristic is used to determine the path of the active explorer window:

/// <summary>
/// Heuristic method to get the path of a shell window
/// </summary>
/// <param name="explorer">File Explorer or Desktop shell window</param>
/// <returns></returns>
private static string GetExplorerPath(InternetExplorer explorer) {

When the active explorer window has multiple tabs (Win 11 feature), this heuristic fails to determine the active tab, and always returns the path of the first tab.

This causes pasting with the hotkey to fail in any but the first tab, since the image is pasted unexpectedly to the path opened in the first tab and not the active tab.

In addition, if autosave is used, the "AsyncRequestFilenameEdit" also fails (unclear if it would work out of the box if the path was correct, or some additional fix is required for the "SelectFileInWindow" method used for this purpose.

To Reproduce

  1. Enable PasteIntoFile to run in tray mode
  2. Open a File Explorer and brows to some folder, then open a second tab with a different folder
  3. With the second tab selected, press WIN+ALT+V and notice the Folder being set to the path of the first tab (or the file being directly pasted there if autosave is enabled)

Error message

Screenshots

Image

Environment

  • App version: 5.6.1
  • OS: Windows 11
  • ...

Solution approach / workarounds

...

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions