
How to navigate to next sibling folder from Windows Explorer?
Re: How to navigate to next sibling folder from Windows Explorer?
Jeeswg --> With your script, I just go in the parent folder, then stop ! No good ! No good ! 

-
- Posts: 2058
- Joined: 29 Mar 2015, 09:41
- Contact:
Re: How to navigate to next sibling folder from Windows Explorer?
JoPo wrote:I would like, is a script that would allow me to go int the previous / next folder, if the parent folder is alone, go in the next parent folder and repeat the same untill to find a folder amonst others and directly going into it.
Code: Select all
#If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass")
^PgUp::
^PgDn:: NavigateToSiblingDir( InStr(A_ThisHotkey, "Up") )
NavigateToSiblingDir(UpDown) {
oShell := ComObjCreate("Shell.Application")
WinGet, hWnd,, A
for oWin in oShell.Windows {
if (hWnd = oWin.hwnd) {
oFolder := oWin.Document.Folder
startDirPath := oFolder.Self.Path
parentDirPath := oFolder.ParentFolder.Self.Path
break
}
}
while parentDirPath {
for item in oShell.Namespace(parentDirPath).Items {
if !item.IsFolder
continue
if (found && nextSiblingPath := item.Path)
break
if (item.Path = startDirPath && found := true)
prevSiblingPath := prev
prev := item.Path
}
if (prevSiblingPath || nextSiblingPath)
break
oFolder := oFolder.ParentFolder
startDirPath := oFolder.Self.Path
parentDirPath := oFolder.ParentFolder.Self.Path
flag := true, found := prev := ""
}
(flag && prevSiblingPath := nextSiblingPath := oFolder.Self.Path)
( (UpDown && (navigatePath := prevSiblingPath)) || (!UpDown && (navigatePath := nextSiblingPath)) )
if navigatePath {
DllCall("shell32\SHParseDisplayName", WStr, navigatePath, Ptr,0, PtrP,vPIDL, UInt,0, Ptr,0)
VarSetCapacity(SAFEARRAY, A_PtrSize=8?32:24, 0)
NumPut(1, &SAFEARRAY, 0, "UShort") ;cDims
NumPut(1, &SAFEARRAY, 4, "UInt") ;cbElements
NumPut(vPIDL, &SAFEARRAY, A_PtrSize=8?16:12, "Ptr") ;pvData
NumPut(DllCall("shell32\ILGetSize", Ptr,vPIDL, UInt), &SAFEARRAY, A_PtrSize=8?24:16, "Int") ;rgsabound[1]
oWin.Navigate2(ComObject(0x2011,&SAFEARRAY), 0)
DllCall("shell32\ILFree", Ptr,vPIDL)
}
}
I'm not sure if I understand what you mean. If the next sibling has many subfolders, which subfolder should the script navigate into?JoPo wrote:I gonna add some difficulty... Eh eh... If the script would allow me to do what I explained + going in the next / previous sibling folder untill it reaches the latest folder (in which there are only files = no more folder to continue to go in) , it would be like heaven !!
Re: How to navigate to next sibling folder from Windows Explorer?
Ah ah ! Good question ! Only the first one, then the script can go to the following one, etc. Untill the last one and next key stroke, plaf ! It goes in the parent again untill it finds the first one with siblings... Like that, you'll explore all the folders one by one, deeply with just one key stroke.
I don't know if it's possible...
I don't know if it's possible...
Re: How to navigate to next sibling folder from Windows Explorer?
Ah... It certainly means that it's not possible. Thanks anyway for your help !
-
- Posts: 1
- Joined: 27 Oct 2020, 15:58
Re: How to navigate to next sibling folder from Windows Explorer?
Sorry to bring up this old tread. But can someone help me get this working with the "Save As" window to navigate the same way as this code works with Windows Explorer?
It works great when I'm using it in Windows Explorer, but I need the same functionality when saving a file in Photoshop. Being able to use ctrl-PgUp or PgDown to flip to the sibling folder when saving would be extremely helpful. Thanks so much!
It works great when I'm using it in Windows Explorer, but I need the same functionality when saving a file in Photoshop. Being able to use ctrl-PgUp or PgDown to flip to the sibling folder when saving would be extremely helpful. Thanks so much!
Code: Select all
; navigate to next sibling folder from Windows Explorer
#If WinActive("ahk_class CabinetWClass") || WinActive("ahk_class ExploreWClass")
^PgUp::
^PgDn:: NavigateToSiblingDir( InStr(A_ThisHotkey, "Up") )
NavigateToSiblingDir(UpDown) {
oShell := ComObjCreate("Shell.Application")
WinGet, hWnd,, A
for oWin in oShell.Windows {
if (hWnd = oWin.hwnd) {
oFolder := oWin.Document.Folder
startDirPath := oFolder.Self.Path
parentDirPath := oFolder.ParentFolder.Self.Path
break
}
}
for item in oShell.Namespace(parentDirPath).Items {
if !item.IsFolder
continue
if (found && nextSiblingPath := item.Path)
break
if (item.Path = startDirPath && found := true)
prevSiblingPath := prev
prev := item.Path
}
if (UpDown && prevSiblingPath)
oWin.Navigate(prevSiblingPath)
if (!UpDown && nextSiblingPath)
oWin.Navigate(nextSiblingPath)
}
Who is online
Users browsing this forum: Bing [Bot], Chunjee, Google [Bot], mikeyww, reklamescobar, RyantheCoder, SenseElation, vilson yuri and 41 guests