How to navigate to next sibling folder from Windows Explorer?

Get help with using AutoHotkey and its commands and hotkeys
kai
Posts: 6
Joined: 30 Aug 2017, 01:31

How to navigate to next sibling folder from Windows Explorer?

19 Nov 2017, 04:05

I am searching for a way to navigate from folder A to folder B from inside folder A:

- Top Folder
-- A (I am here)
-- B

AHK-Shortcut, then:

- Top Folder
-- A
-- B (now I am here)

Can somebody help?
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

19 Nov 2017, 10:35

Here's a way. I've been using something like this for a while, I just tidied it up now for sharing. I wonder, how many people around the world have been using a handy 'navigate to sibling folder' method before now.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by jeeswg on 06 Mar 2018, 14:50, edited 2 times in total.
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

19 Nov 2017, 15:35

It's a bit confusing. :)
For me this works:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

kai
Posts: 6
Joined: 30 Aug 2017, 01:31

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 01:37

Thanks both of you!!

I tried both scripts and they work great. THIS is awesomeness!!

Note (bug): Both scripts do not jump in folders with a underline as it seems, e.g. "_files"

@teadrinker's script: Nicely short!

It is so handy and saves soooo much time! Gosh, unbelievable that I never used this in my life.

@jeeswg: Everybody should use it! It is such a simple feature but so powerful.
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 10:14

- On testing, I didn't see any problems with folders that contain underscore. However you can get different sort orders relating to underscore i.e. Explorer displays folders in one order, the file loop retrieves them in another.
- In this list of characters sorted by their Unicode number:
@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_
`abcdefghijklmnopqrstuvwxyz{|}~
To do a case insensitive comparison, you either convert to lowercase or uppercase, and then you do a case sensitive comparison. If you convert to uppercase as the intermediary stage, then letters are always before underscore (e.g. file loop), if you convert to lowercase as the intermediary stage, then letters are always after underscore (e.g. Explorer windows). E.g. create a folder called 'a' and a folder called '_', and compare where they appear in an Explorer window, and in a file loop.
- My script is longer because I included some code to handle folders that contain #, which you could also use in teadrinker's script.
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 10:34

jeeswg wrote:I included some code to handle folders that contain #
I tested my script with folders called like "#files", it works. Do I misunderstand something?
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 10:40

kai mentioned _, I mentioned #.

Re. #:
4 options to change the current folder in Windows Explorer - Page 3 - AutoHotkey Community
https://autohotkey.com/boards/viewtopic.php?f=5&t=526&p=16161#p16161
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 11:15

Your link is to reformatcode.com? What is that, a clone of the Stack Overflow link? Is the link safe?

windows - Navigate Shell command not working when the path includes an hash - Stack Overflow
https://stackoverflow.com/questions/22868546/navigate-shell-command-not-working-when-the-path-includes-an-hash

Btw vafylec's Navigate2 solution is the same as mine, our code is often very similar.
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 13:04

Ok, but your approach opens a new window when navigates to folder which contains "#". Some improvements:

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

Last edited by teadrinker on 20 Nov 2017, 14:42, edited 1 time in total.
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 13:09

Which OS do you use? Did you change the Explorer settings? My script does not open any new windows AFAIK (tested on Windows 7).

So what have you changed, you've added navVirtualTab := 14 to Navigate2, which seems like a good idea. Anything else?
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

20 Nov 2017, 13:29

Tested on Windows 7 too. My folder path is:

Image

When I try to navigate between those folders, your script always opens a new window for me. Of course IE settings were changed for a long time using, but I don't know what exactly causes such behavior.
Anything else?
I thought, if navigate method not always works, it makes sense using navigate2 in any case.
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

26 Nov 2017, 00:48

@teadrinker:
- You specified 'navVirtualTab := 14', which is 0xE. Where did you get that figure from? Because according to ExDisp.h and:
BrowserNavConstants Enumeration
https://msdn.microsoft.com/en-us/library/dd565688(v=vs.85).aspx

Code: [Select all] [Download] GeSHi © Codebox Plus

;navNoWriteToCache := 0x8
;navNoReadFromCache := 0x4
;navNoHistory := 0x2
2|4|8 = 14 = 0xE

;navVirtualTab := 0x4000

- Could you try that script again, but specifying 0 or 2 or 4 or 8 or combinations, to see if you don't actually need 14. Thanks.
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

26 Nov 2017, 13:21

Hi, jeeswg. Yes, you are right, navVirtualTab is not 14. I looked constants here and I thought for some reason that it is a 0-based enumerator: navOpenInNewWindow = 0, navNoHistory = 1 and so on.

Now I've tested the script once again and found out that if I don't specify any flags, the script does open new windows, but if I specify 0 (as well as 2, 4, or 8), the script does not.
User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

26 Nov 2017, 14:55

@teadrinker:
Many thanks, I'll change my script from:
oWin.Navigate2(ComObject(0x2011, &SAFEARRAY))
to
oWin.Navigate2(ComObject(0x2011, &SAFEARRAY), 0)
Plus, it's good to know where the number came from.
Btw it's odd these links, one has the constants, one doesn't. Hmm. :think:
JoPo
Posts: 23
Joined: 04 Feb 2018, 09:03

Re: How to navigate to next sibling folder from Windows Explorer?

06 Mar 2018, 08:37

Hi !
I bring back this thread with this useful script because I'd like to add a little bit different behavior : I wish that if the parent folder is alone (so there is no down or up folder to go, for the moment, in this case, nothing happens) , it would go to its parent untill it finds the first parent folder where there are other (up or down, depending if user choose to go up or down) folder. :?

And I must confess & admit that I don't find any solution ! :roll: :crazy: I haven't got yet enough knowledge about Autohotkey to achieve this. But I like to learn ! Some help would be very very appreciate ! Thanks a lot to any help ! :)
> > > > > > > > > > > > --- Musica --> here ! ---< < < < < < < < < < < <
teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

06 Mar 2018, 14:29

Hi, like this?

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

User avatar
jeeswg
Posts: 4509
Joined: 19 Dec 2016, 01:58
Location: UK

Re: How to navigate to next sibling folder from Windows Explorer?

06 Mar 2018, 14:54

@teadrinker: Could you explain what your script does? Thanks.
@JoPo: Could you try explaining that again? Thanks.
E.g. give examples of source and destination folders.
Also, do you want two hotkeys in total, an up action and a down action?
I have a script here that may be related, it navigates up to the parent folder, or down to the child folder (if there is only one child folder). The hotkeys are Ctrl+Win+PgUp and Ctrl+Win+PgDn.

Code: [Select all] [Expand] [Download] GeSHi © Codebox Plus

teadrinker
Posts: 382
Joined: 29 Mar 2015, 09:41
Contact:

Re: How to navigate to next sibling folder from Windows Explorer?

06 Mar 2018, 15:19

jeeswg wrote:@teadrinker: Could you explain what your script does?
If the current folder has no sibling folders, the script navigates to the parent folder.
JoPo
Posts: 23
Joined: 04 Feb 2018, 09:03

Re: How to navigate to next sibling folder from Windows Explorer?

06 Mar 2018, 16:07

The nice script at the beginning of this thread allows you to jump from the folder you're in windows browser to the next one just by control + page down. If the parent folder is alone = doesn't have folder before nor after, you stay in the same folder.

Whet 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.

Thanks, Teadrinker ! But the new script send me just in the parent folder (in the case of a lonely folder, without sibling folder) and stops. I'm totally unable to explain you why ! :mrgreen:
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 !! :o
> > > > > > > > > > > > --- Musica --> here ! ---< < < < < < < < < < < <

Return to “Ask For Help”

Who is online

Users browsing this forum: havox, Siskin and 8 guests