Expand Folders Command

A true god amongst men... excellent script!

2 Likes

@errante

Here is my example of the fruits of your hard labor - a single button to offer all the options for Expandable Folders. It could not have been done without your script!

There are two versions with the same functionality but in different formats.

Version 7

Expanded Folders Options 3 Button.dcf (4.3 KB)
Expanded Folders Options Menu.dcf (3.6 KB)

2 Likes

Update v1.2.0 Beta 1 (2024-02-08):

  • Now when expanding only the top level, a new thread is not initiated.
  • Added SELECT and SELECT=dirs, which allows to select the files/dirs whose parents are the newly expanded folders.

I got the idea from seeing jinsight's button, which seems to want to select the newly appeared items resulting from the recent folder expansion. Seems something useful to have at hand.

Now you can use SELECT along with EXPAND or TOGGLE, to select all the files or just the dirs (using SELECT=dirs).

Test it and let me know how it goes.

Updated main post with v1.2.1, which contains all the changes introduced in the latest beta.
I also updated the description for arguments, and added some new examples.

1 Like

v1.3.0 (Feb 22, 2024):
If you are using a previous version, is highly recommended to update to this one.

  • COLLAPSE has a new value : levels, to effectively collapse all the expanded folders in all levels.
  • Added colparent and collevels values for TOGGLE, to enable the corresponding values for collapse.
  • A problem with the custom progress dialog that interfered with other listers/windows, minimizing/bringing them to the front, has been fixed.
2 Likes

sorry, can't confirm working COLLAPSE=levels or TOGGLE=collevels option. can you give a small gif with all them collapsed. i've got only upper level collapsed

It is working. But keep in mind that wildcards are used to identify folders, so if there is a matching higher level folder, it is collapsed without collapsing their child expanded folders.

Without levels :

With levels :

Does not collapse all levels
I expected that "ExpandFolders TOGGLE=collevels" would collapse all the expanded folders in all levels. My test folder is at the top level within the file display lister.

Does collapse all levels
ExpandFolders COLLAPSE=parent,levels

can i toggle select with your beatiful code =return "ExpandFolders EXPAND" + (KeyDown("shift") ? "" : "=top") + (KeyDown("ctrl") ? " SELECT" : ""); ? and add collapse here?

@jinsight @fkast you were right! levels was not working if there's something selected. Can you try this version to know if it is working now?
ExpandFolders.opusscriptinstall (5.0 KB)
Thanks!

I'm not quite understanding what you mean here. Are you saying you want to create a similar button but for collapse?
SELECT doesn't work with COLLAPSE

I have five different buttons with this script and I am not completely satisfied with any of them. the code above is the closest to what I want, except TOGGLE=select and for ex. alt-pressed COLLAPSE. i need all in one button))))))))))

can't confirm. with ExpandFolders TOGGLE=collevels i've got only upper level collapsed.

expand

I don't think you can fit everything into a single button :laughing:. But you can try it; I'm not sure how good the Alt modifier works on buttons.

My guess is that there are lower-level folders with the same name as the higher-level ones.
Can you send me a similar capture but with debug=ALL and showing the Scripts log?
You can send me via message if you like.

At least can you add toggle select ?)))

SELECT acts as a toggle, you can pass that argument along with COLLAPSE, it will be ignored.

here as a toggle (i.e. select/select none) ???
=return "ExpandFolders EXPAND" + (KeyDown("shift") ? "" : "=top") + (KeyDown("ctrl") ? " SELECT" : "");

not for me))) sorry... it only expands and selects one next level with second-third ctrl key

That's not related with the command itself, but the code basically says:
default : ExpandFolders EXPAND=top
with shift : ExpandFolders EXPAND
with ctrl : ExpandFolders EXPAND=top SELECT
with shift+ctrl : ExpandFolders EXPAND SELECT

That's pure Evaluator in action.

@errante

New version 1.3.1 does NOT collapse all levels
I expected that "ExpandFolders TOGGLE=collevels" would collapse all the expanded folders in all levels. My test folder is at the top level within the file display lister.

Does collapse all levels where either the parent or a subfolder or a file under the parent is selected
ExpandFolders COLLAPSE=parent,levels
I would like this effect available under the toggle option.

Thank you so much for all your efforts!