GP SoftwareTwitter
Opus FAQsManualCommandsObjects

How to Navigate from a sub folder to Next or Previous sub folder?

My folder structure is:

Album_A\sub_folder_1
Sub_folder_2
Sub_folder_3

Album_B\sub_folder_1
sub_folder_2

Album_C\sub_folder_1

Album_D\sub_folder_1

In my file Display, I open "Album_A\sub_folder_1" Now I want to go directly into "Album_B\sub_folder_1" then from here to Album_C\sub_folder_1

Note: in real senary, every album name in a deferent name in Unicode (Bangla) and every sub_folder name is also in a deferent name in Unicode (Bangla). Every Album folder contains minimum one subfolder or one more subfolder. I want to Navigate the first subfolder to next first subfolder

Julianon's script here does something similar with its depth argument:

Leo I have already tried that button

@Set TheDirectory={SourcePath|NoPath}
Go Up
GoRelative Sibling=Next Wrap SkipHidden
Go {$TheDirectory}

but It's not worked for me. It's only work in the folder structure as Julianon said
2014\Tax
2015\Tax
2016\Tax
2017\Tax
I have also tested the button, with changing the subfolder name "Tax" to "Token"
2014\Token
2015\Token
2016\Token
2017\Token
The button also worked in that structure. But when I had tried the button in that structure
2014\Token
2015\tax
2016\taxxx
2017\Tokennn
then it's not worked. That means This button maybe works only when the subfolder name is the same. But in my case each of the subfolder names is different. so in my folder structure, That button behavior goes to just crazy.
I give here my original folder structure. Now you can create that situation and test that button your self and I hope you will find some solution. my original folder structure is:

অপরাধী হইলেও আমি তোর. শিল্পী. বারী সিদ্দিকী\অপরাধী হইলেও আমি তোর Covers
অপরাধী. শিল্পী. আসিফ, অভিজিৎ\অপরাধী Covers
অবশেষে. শিল্পী. হাবিব, ফেরদৌস ওয়াহিদ\অবশেষে Covers
অভিসার. শিল্পী. শাহীন সামাদ\অভিসার Covers

Note: don't be confused about my structure. Here is actually album name before the \ and after the \ is the folder contain album scanned covers photo. I want to navigate covers to next/previous covers folder

You aren't using the depth argument. I don't think you would need to go up a level first, either.

1 Like

Ok, As you said I just remove go up a level part from my button code. and now the button code is

@Set TheDirectory={SourcePath|NoPath}
GoRelative Sibling=Next Wrap SkipHidden
Go {$TheDirectory}

But When I click this button This button show an error massage like the screenshot


plz Leo Do something.

Depth argument.

Leo are we talking about the same script? I use the script provided by you is Go_to_Relative.vbs and I don't find any option in argument section Named Depth argument . Can you tell me something details.

Leo was talking about Julianon's version of the script. He gave you a link to it in his original response.

Ok Here I am again. Now I Use The GoRelative.js.txt (14.8 KB) script. I flow the Instruction: I Delete the Go_to_Relative.vbs Before I Install GoRelative.js.txt. Now I Create the Demo Folder structure As Julianon Said Like That:
...\Lessons\2016\Class09 and
...\Lessons\2017\Class09
And Create Two Button with This Code:
GoRelative Depth=2 Sibling=Previous (or Sibling=-1 )
GoRelative Depth=2 Sibling=Next (or Sibling=1 )
And The Button Works Fine, No Error
Now I had Tried the button In my Wanted Folder structure Which is:
D:\Project Secure\অবশেষে. শিল্পী. হাবিব, ফেরদৌস ওয়াহিদ\অবশেষে Covers
D:\Project Secure\অপরাধী. শিল্পী. আসিফ, অভিজিৎ\অপরাধী Covers
D:\Project Secure\অপরাধী হইলেও আমি তোর. শিল্পী. বারী সিদ্দিকী\অপরাধী হইলেও আমি তোর Covers
Suppose I am in D:\Project Secure\অপরাধী. শিল্পী. আসিফ, অভিজিৎ\অপরাধী Covers Now I Press The Next Button which had This code: GoRelative Depth=2 Sibling=Next
This Button open D:\Project Secure\অপরাধী হইলেও আমি তোর. শিল্পী. বারী সিদ্দিকী
But It should Open D:\Project Secure\অপরাধী হইলেও আমি তোর. শিল্পী. বারী সিদ্দিকী\অপরাধী হইলেও আমি তোর Covers
And Show an Error Massage: Opening an ancestor of the target

1

And The Previous Button Do The Same Things also

How to Solve It? Dear Jon, Leo, Julianon

Is There Any One please give a reply!!

Maybe if you give some examples using English folder names people might find it easier to understand what you're asking.

Thanks Jon for reply.
I asking a very simple Things Here Is Simple English Folder List

\Lessons\Abcd Xyz\Any Name Folder
\Lessons\Efgh Ijkl\My Folder
Now I Want to go from Any Name Folder to My Folder with a Next button and as well as Want to go Back from My Folder to Any Name Folder with a Previous button
am I make me clear? There is nothing common in the folder Name? Every Folder Name is Different But The Main Parent Folder Name Lessons

Is this what you want to do?

Siblings.zip (719 Bytes)

1 Like

Thank you so much pctechtv for your video clip. But I don't want What you shown in your video. In your video you Navigate the folder in same level. But I want to navigate depth in one level. for example you are in D:\Backup\Important Photo and you want to go in D:\CD Images\Titanic That's what I mean One level depth. Am I Clear?

Your top level folder Lessons could have any number of subfolders and each subfolder could have any number of 2nd level subfolders, e.g:

\lessons\one\chapter1
\lessons\one\chapter2
\lessons\one\chapter3
etc
\lessons\two\episode1
\lessons\two\episode2
\lessons\two\episode3
etc
\lessons\three\part1
\lessons\three\part2
\lessons\three\part3
etc

If you were currently positioned in \lessons\one\chapter1 what folder would you expect "next" to go to and what logic would you use to make that decision given that there are many possible target folders at the same depth?

1 Like

The Logic is folder position number after sort by folder name.
Let me explain,
\lessons\one\chapter1
\lessons\one\chapter2
\lessons\one\chapter3
etc

In This case I sort all last Child folder by Folder name. Then
chapter1 Folders position number will be 1
chapter2 Folders position number will be 2
chapter3 Folders position number will be 3

\lessons\two\episode1
\lessons\two\episode2
\lessons\two\episode3
etc

episode1 Folders position number will be 1
episode2 Folders position number will be 2
episode3 Folders position number will be 3

We can create some argument called PositionNumber or something like that. If we use PositionNumber=1 Then the Next Button will Navigate me from

\lessons\one\chapter1
\lessons\one\chapter2
\lessons\one\chapter3 (or any other child folder like... chapter 22 or......chapter29)

to \lessons\two\episode1

Because there is other folder in the same depth but their position number is different.
In the same depth
episode2 Folders position number is 2
episode3 Folders position number is 3

If we use PositionNumber=2 Then the Next Button will Navigate me
\lessons\one\chapter1
\lessons\one\chapter2
\lessons\one\chapter3 (or any other child folder like... chapter 22 or......chapter29)

to \lessons\two\episode2

If I now understand you correctly you always want to jump to the Nth folder in the next subfolder at depth 2? For example, let's assume a folder structure as follows, sorted by name, and a command called MyGoNext that does what you want:

c:\animals\cats\burmese
c:\animals\cats\siamese
c:\animals\cats\tabby
c:\animals\dogs\beagle
c:\animals\dogs\collie
c:\animals\dogs\labrador
c:\animals\horses\arabian
c:\animals\horses\belgian
c:\animals\horses\shetland

If your starting point is any one of:

c:\animals\cats
c:\animals\cats\burmese
c:\animals\cats\siamese
c:\animals\cats\tabby

MyGoNext 1 will take you to c:\animals\dogs\beagle
MyGoNext 2 will take you to c:\animals\dogs\collie
MyGoNext 3 will take you to c:\animals\dogs\labrador

If your starting point is any one of:

c:\animals\dogs
c:\animals\dogs\beagle
c:\animals\dogs\collie
c:\animals\dogs\labrador

MyGoNext 1 will take you to c:\animals\horses\arabian
MyGoNext 2 will take you to c:\animals\horses\belgian
MyGoNext 3 will take you to c:\animals\horses\shetland

If this is correct then you need to decide how you want to handle special situations. For example, what would you expect MyGoNext 4 to do? Nothing? Likewise, if your starting point is somewhere in the c:\animals\horses structure would you want MyGoNext to loop back to c:\animals\cats or do nothing? What about a situation where your starting position is c:\animals (i.e. depth 1) - just go to c:\animals\cats or do nothing?

1 Like

YES This is correct But Not Fully Correct.
This is correct when my Starting point is:
c:\animals\cats\burmese
c:\animals\cats\siamese
c:\animals\cats\tabby

But when my starting point is: c:\animals\cats Then
MyGoNext1 will go in c:\animals\dogs
MyGoNext2 will go in c:\animals\horses\

Ok let's talk about Special Situations.
Special Situations - 1:

If My Starting point is: c:\animals\horses\shetland
I want MyGoNext4 to loop back to c:\animals\cats\burmese

Special Situations - 2:

If my starting position is c:\animals (i.e. depth 1) Then MyGoNext will Open c:\Birds

The attached script will do what you want. It expects a positive or negative integer argument, e.g. KHGo 1, KHGo 2, KHGo -1, KHGo -2, etc.. If you don't supply an argument it defaults to 1. Positive arguments take you FORWARD through a structure, negative arguments take you BACKWARD. I will also attach a zip file of the "animals" structure I used during testing.

KHGo.js.txt (6.0 KB)
animals.zip (2.1 KB)

Edit: 2019-12-02 Updated to v1.1. Fix to handle single folder in structure depth > 3.

3 Likes

Should this be put in a button? Thanks