Navigate an Explorer object to a CLSID address

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Navigate an Explorer object to a CLSID address

15 Dec 2014, 19:26

I'm using the .Navigate method to change the current folder in an Explorer window.

Code: Select all

    For pExp in ComObjCreate("Shell.Application").Windows
    {
        if (pExp.hwnd = hwnd) { ; matching window found
            pExp.Navigate(FullPath) ; *** DOES NOT ACCEPT CLSID IN THE FORMAT "::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}"
            return
        }
    }
(see: http://ahkscript.org/boards/viewtopic.php?f=5&t=526)

I was planning to use this method to navigate an Explorer to a system or virtual folders identified by CLSID like Network "{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}", My Computer "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" or tens of other useful resources.

The issue is that the .Navigate method does not accept CLSID as parameter. The alternative method .Navigate2 does not either. I know these addresses work with the Run command (try Run, ::{20D04FE0-3AEA-1069-A2D8-08002B30309D}). But I want to navigate the current Explorer? Do you know any other method to navigate an Explorer window to a CLSID address?

There is the SendInput ({F4} etc.) method that could do it but it proved to be much less reliable than the Explorer object Navigate method.

Thanks for any input on this issue.

Jean
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

15 Dec 2014, 20:46

Maybe if you try "shell:" commands?

shell:NetworkPlacesFolder

See http://www.sevenforums.com/tutorials/49 ... mmand.html
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

15 Dec 2014, 22:32

joedf wrote:Maybe if you try "shell:" commands?

shell:NetworkPlacesFolder

See http://www.sevenforums.com/tutorials/49 ... mmand.html
Yes, it works! I knew about these registry keys "Shell Folders" (HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders) but I did not know about the shell: commands. Tanks you JoeDF !

For the record, I was also looking after the Explorer object .Navigate2 command that accepts these ShellSpecialFolderConstants (http://msdn.microsoft.com/en-us/library ... 85%29.aspx).

I wonder which approach (Shell: or ShellSpecialFolderConstants) is recommended to work from WinXP to most recent Win versions?
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

16 Dec 2014, 01:33

I'm glad that it works :)
It seems to me that the shell commands is only for Win7+
And the Shell constants might be support by vista or older.. I'm not sure, the best thing is to actually test it! ;)
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

23 Dec 2014, 23:37

For the record, I found that the following ShellCommand work in Win_XP with the command "Run Explorer shell:command"

Code: Select all

AppData
Cache
Common Administrative Tools
Common AppData
Common Desktop
Common Start Menu
Common Startup
ConnectionsFolder
ControlPanelFolder
Cookies
Desktop
Favorites
History
My Music
My Pictures
My Video
Personal
PrintersFolder
Profile
ProgramFiles
Recent
RecycleBinFolder
Start Menu
Startup
Templates
Windows
The other ones work only under Win_7 and more. For complete lists of ShellCommand, see:
http://www.sevenforums.com/tutorials/49 ... mmand.html
http://www.eightforums.com/tutorials/60 ... s-8-a.html

Speaking of special folder references, this is the list of special constants (to use with Explorer object method .Explore2):
http://msdn.microsoft.com/en-us/library ... 85%29.aspx
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey
User avatar
joedf
Posts: 8937
Joined: 29 Sep 2013, 17:08
Location: Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

24 Dec 2014, 06:04

Hmm the other ones probably only work under win7 because they don't exist in winXP?
Image Image Image Image Image
Windows 10 x64 Professional, Intel i5-8500, NVIDIA GTX 1060 6GB, 2x16GB Kingston FURY Beast - DDR4 3200 MHz | [About Me] | [About the AHK Foundation] | [Courses on AutoHotkey]
[ASPDM - StdLib Distribution] | [Qonsole - Quake-like console emulator] | [LibCon - Autohotkey Console Library]
User avatar
TLM
Posts: 1608
Joined: 01 Oct 2013, 07:52
Contact:

Re: Navigate an Explorer object to a CLSID address

24 Dec 2014, 08:18

The shell object also has a set of special folder constants that can be used with its Open() method.

For instance:

Code: Select all

sObj := ComObjCreate("Shell.Application")
sObj.Open( 0x12 ) ; ssfNETWORK           = 0x12
To get it to work with your code, you could do something like:

Code: Select all

    For pExp in ( sObj := ComObjCreate("Shell.Application") ).Windows
    {
        if (pExp.hwnd = hwnd) { ; matching window found
            sObj.Open( 0x12 )
        }
    }
See full ShellSpecialFolderConstants enum here: http://msdn.microsoft.com/en-us/library ... 85%29.aspx
See Open() Method here: http://msdn.microsoft.com/en-us/library ... 85%29.aspx
The Explore() method does the same thing as Open(): http://msdn.microsoft.com/en-us/library ... 85%29.aspx

hope this helps
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Navigate an Explorer object to a CLSID address

17 Oct 2019, 05:01

I found a way to navigate an Explorer window/object to a CLSID:

Code: Select all

;q:: ;Explorer - navigate to CLSID/shell command (tested on Windows 7)
;vDir := "shell:::{F02C1A0D-BE21-4350-88B0-7367FC96EF3C}" ;Network
vDir := "shell:::{20D04FE0-3AEA-1069-A2D8-08002B30309D}" ;Computer
;vDir := A_Desktop "\New Folder" ;more breadcrumbs (in address field)
;vDir := "shell:Desktop\New Folder" ;fewer breadcrumbs (in address field)

WinGet, hWnd, ID, A
WinGet, vPName, ProcessName, % "ahk_id " hWnd
if !(vPName = "explorer.exe")
	return
for oWin in ComObjCreate("Shell.Application").Windows
{
	if (oWin.HWND = hWnd)
	{
		oWin.Navigate(vDir)
		break
	}
}
oWin := ""
return
The two clues were: joedf mentioning 'shell:', and having seen 'shell:::{MyCLSID}' syntax, as used here:
jeeswg's Explorer tutorial - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=7&t=31755
What prompted me to investigate, was navigating to folders on the Desktop with more/fewer breadcrumbs in the address field.

Links:
[I couldn't find the term, or a list of, 'shell commands' at MSDN]
[apparently 'shell:' is related to 'about:blank', i.e. monikers]
protocols - Where can I learn about the "shell:" URI? - Stack Overflow
https://stackoverflow.com/questions/3605148/where-can-i-learn-about-the-shell-uri

CLSID Key List for Windows 7 - Windows 7 Help Forums
https://www.sevenforums.com/tutorials/110919-clsid-key-list-windows-7-a.html
Shell Command - Windows 7 Help Forums
https://www.sevenforums.com/tutorials/4941-shell-command.html
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
JnLlnd
Posts: 487
Joined: 29 Sep 2013, 21:29
Location: Montreal, Quebec, Canada
Contact:

Re: Navigate an Explorer object to a CLSID address

17 Oct 2019, 07:38

jeeswg wrote:
17 Oct 2019, 05:01
I found a way to navigate an Explorer window/object to a CLSID:
This works well. Thanks jeeswg.
:thumbup: Author of freeware Quick Access Popup, the powerful Windows folders, apps and documents launcher!
:P Now working on Quick Clipboard Editor
:ugeek: The Automator's Courses on AutoHotkey

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: marypoppins_1 and 169 guests