Keyboard shortcut to Jump to Next folder

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
DarKHawK
Posts: 17
Joined: 25 Nov 2012 04:55

Keyboard shortcut to Jump to Next folder

Post by DarKHawK »

Hi,

Is there any hidden to jump to the next inline folder?

Thanks.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Keyboard shortcut to Jump to Next folder

Post by highend »

You mean from anything that's currently selected (e.g. a file) or in e.g. a manual sorted list from:

afolder
a.txt
bfolder
c.txt

directly from afolder to bfolder?

I'm not aware of something preexisting but you could use a UDC and assign it a keyboard shortcut and use a script:

Code: Select all

    $preMatch = ""; $postMatch = ""; $items = listpane(); $curPos = get("FocusedPos");
    while ($i++ < gettoken($items, "count", "|")) {
        $item = gettoken($items, $i, "|");
        if (exists($item) != 2 ) { continue; }
        if ($i > $curPos) { $postMatch = $item; break; }
        if ($preMatch) { continue; }
        if ($i <= $curPos) { $preMatch = $item; }
    }
    selectitems ($postMatch) ? $postMatch : (($preMatch) ? $preMatch : <curitem>);
One of my scripts helped you out? Please donate via Paypal

DarKHawK
Posts: 17
Joined: 25 Nov 2012 04:55

Re: Keyboard shortcut to Jump to Next folder

Post by DarKHawK »

Thank you for your reply.

I didn't mean it like that. For that I would use the arrow keys.

I mean if I'm currently in a folder which contains files.
I want to jump directly to the next folder and open it.

mainfolder
subfolder1
subfolder2
subfolder3

If I'm current in subfolder2 viewing those files, I want to jump directly to subfolder3.

Thanks again.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Keyboard shortcut to Jump to Next folder

Post by highend »

This one doesn't contain the logic to jump back to a folder that's above the one you're currently in...

Code: Select all

    $parentFolders = listfolder(regexreplace(<curpath>, "^(.*)(\\.*)", "$1"), , 2);
    $curPos = gettokenindex(<curpath>, $parentFolders, , "");
    $nextFolder = "";
    while ($curPos++ < gettoken($parentFolders, "count", "|")) {
        $item = gettoken($parentFolders, $curPos, "|");
        if (exists($item) == 2 ) { $nextFolder = $item; break; }
    }
    if ($nextFolder) { goto $nextFolder; }
One of my scripts helped you out? Please donate via Paypal

DarKHawK
Posts: 17
Joined: 25 Nov 2012 04:55

Re: Keyboard shortcut to Jump to Next folder

Post by DarKHawK »

This script jumps to first subfolder in the current main folder.

mainfolder
---subfolder1
---subfolder2
---subfolder3
---subfolder4
---subfolder5
---subfolder6

If I'm in subfolder 2-6 and I run the script I jump to subfolder1
What I need is that If I'm in subfolder2 for example and ran the script I would jump to subfolder3, and then subfolder4 and so on.

Correct me if I'm wrong, User > Manage Commands > Run Script > New > and past the script in the script edit window!

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Keyboard shortcut to Jump to Next folder

Post by highend »

Not for me.

If I'm in subfolder1 and run the script it jumps to subfolder2, etc. When in subfolder6 it stays there ($nextFolder is empty -> No jump)
One of my scripts helped you out? Please donate via Paypal

DarKHawK
Posts: 17
Joined: 25 Nov 2012 04:55

Re: Keyboard shortcut to Jump to Next folder

Post by DarKHawK »

I found what's wrong.
If the root folder had "#" in it I get that strange behavior I described earlier.

#newfolder
--1
--2
--3
--4

Jumping from 2 to 3 makes a jump back 1. If I removed the "#" from the newfolder the script works fine.
Also happens with the next scinario when the "#" is a middle folder and not the root.

newfolder
--#
----1
----2
----3

I usually use the "#" a lot to rename my folders I want to keep near the top.
If there is no solution for it I can switch to any other character.
I'm very grateful either way.
Thank you.

highend
Posts: 14996
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

Re: Keyboard shortcut to Jump to Next folder

Post by highend »

Change:

Code: Select all

$curPos = gettokenindex(<curpath>, $parentFolders);
to

Code: Select all

$curPos = gettokenindex(<curpath>, $parentFolders, , "");
I've edited the script posted above to reflect this change...
One of my scripts helped you out? Please donate via Paypal

Post Reply