[AutoHotkey v2] Redirect Explorer Windows

Discuss and share scripts and script files...
Post Reply
Norn
Posts: 415
Joined: 24 Oct 2021 16:10

[AutoHotkey v2] Redirect Explorer Windows

Post by Norn »

The redirection process hides the Explorer window and is normally invisible. The ini file is a configuration file and can be modified according to needs.
RedirectExplorerWindows_TrayMenu.png
RedirectExplorerWindows_TrayMenu.png (21.11 KiB) Viewed 585 times
CLSID list

v1.0.5: Added wildcard support to excluded lists.
v1.0.4: Added excluded list, one per line not ending with "\".
v1.0.3: Fixed redirection Control Panel.
RedirectExplorerWindows_(AutoHotkey_v2)_v1.0.5.zip
(19.39 KiB) Downloaded 17 times
RedirectExplorerWindows_(AutoHotkey_v2)_v1.0.3.zip
(18.76 KiB) Downloaded 14 times
RedirectExplorerWindows_(AutoHotkey_v2)_v1.0.zip
(16.69 KiB) Downloaded 18 times
Last edited by Norn on 26 Nov 2023 16:30, edited 5 times in total.
Win10, Win11 @100% 2560x1440 22H2

xy123
Posts: 141
Joined: 17 Sep 2017 11:46

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by xy123 »

This is perfect, thank you for sharing. :appl:


d.romeo
Posts: 34
Joined: 08 Oct 2021 23:22

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by d.romeo »

How to add a list of custom window names to exclude from re-addressing? For example, This PC||myPath?

Norn
Posts: 415
Joined: 24 Oct 2021 16:10

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by Norn »

Try v1.0.4.

Code: Select all

[excludeList_OnePerLine]
::{26EE0668-A00A-44D7-9371-BEB064C98683}
E:\Test
Win10, Win11 @100% 2560x1440 22H2

d.romeo
Posts: 34
Joined: 08 Oct 2021 23:22

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by d.romeo »

It doesn't seem to work, even the control panel doesn't work anymore:

Code: Select all

[RedirectToggle_1=SecondComandLine]
key=0
[TrayMenu_DarkMode]
key=1
[excludeList_OnePerLine]
::{26EE0668-A00A-44D7-9371-BEB064C98683}
*.pbd
Questo PC
This PC
C:

Norn
Posts: 415
Joined: 24 Oct 2021 16:10

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by Norn »

I added wildcard support in v1.0.5. This PC, Home, etc. need to use CLSID, such as::{20D04FE0-3AEA-1069-A2D8-08002B30309D}, or use a script to get it:

Code: Select all

#Requires AutoHotkey v2.0
f3::                         ; Press F3 to get the Explorer Selection
{
    explorerItems := explorerGetSelection()
	msgbox("Path Copied!`n" . explorerItems)
	A_Clipboard := explorerItems
}

explorerGetSelection(hwnd := WinExist("A")) {   ; by ntepa -- https://www.autohotkey.com/boards/viewtopic.php?p=529074#p529074
    if !RegExMatch(WinGetClass(hwnd), "^((?<Desktop>Progman|WorkerW)|CabinetWClass)$", &Match)
        return
    shellWindows := ComObject("Shell.Application").Windows
    ; get desktop or explorer window.
    if Match.Desktop ; 0x13 = VT_UI4, 0x8 = SWC_DESKTOP
        window := shellWindows.Item(ComValue(0x13, 0x8)).Document
    else {
        try activeTab := ControlGetHwnd("ShellTabWindowClass1", hwnd)
        for w in shellWindows {
		    try {
                if w.hwnd != hwnd
                    continue
                if IsSet(activeTab) {
                    IID_IShellBrowser := "{000214E2-0000-0000-C000-000000000046}"
                    shellBrowser := ComObjQuery(w, IID_IShellBrowser, IID_IShellBrowser)
                    ComCall(3, shellBrowser, "uint*", &thisTab:=0)
                    if thisTab != activeTab
                        continue
                }
                window := w.Document
                break
			}
        }
    }

    Items := ""
    try for i, in window.SelectedItems {
        Items .= (A_Index > 1 ? "`n" : "") i.Path ; append each selected item and add a new line.
    }
	else
        return window.Folder.Self.Path
	catch
	    for window in shellWindows
		    try if (window.hwnd==hwnd)
				for i, in window.SelectedItems
                    Items .= (A_Index > 1 ? "`n" : "") i.Path ; append each selected item and add a new line.

    return Items
}
Win10, Win11 @100% 2560x1440 22H2

d.romeo
Posts: 34
Joined: 08 Oct 2021 23:22

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by d.romeo »

It works, thank you very much. If there are new versions, I will download them immediately ;)

autocart
Posts: 1234
Joined: 26 Sep 2013 15:22

Re: [AutoHotkey v2] Redirect Explorer Windows

Post by autocart »

Norn wrote: 26 Nov 2023 16:38This PC, Home, etc. need to use CLSID, such as::{20D04FE0-3AEA-1069-A2D8-08002B30309D}, ....
Norn wrote: 23 Sep 2023 23:45 CLSID list
Ah, neat! :)

Post Reply