DO11: folder sizes shortcut behavior vs. DO10

In Opus 10 if we press CTRL+L twice while some folder is selected it will calculate folder sizes of all folders in that lister rather than just of selected folder. In DO11 this doesn't work that way, we have to deselect any selected folder(s) first if we want to get folder sizes of all folders in a lister (i.e., pressing CTRL+L twice has no different effect than pressing it once).

I prefer the Opus 10 behavior with this, please update.

Edit the command and remove @nodeselect from it to get the old behaviour back.

Thanks for the quick reply, it works!

Now I encountered a case when default Opus 11 behavior is desirable. :laughing: Is it possible to merge this functionality: never deselect but 2x CTRL-L makes it calculate other folder sizes?
I tried Select RESELECT after GetSizes but it doesn't seem to work. Also (alternatively) I think it must be possible to do similar thing with new Opus 11 functionality of assigning multi-key sequences for example CTRL+L, L?

Not in any sensible way I can think of.

I think a better idea would be to bind a hotkey to Select NONE and use that before pushing Ctrl+L if you want to calculate the size of everything.

Or you could make e.g. Ctrl+Shift+L calculate the size of all folders and Ctrl+L only calculate the size of the selected ones.

You could try something like the following:

@nodeselect

@ifset:$src:getsizeflag
select none
@set src:getsizeflag=

@ifset:else
@set src:getsizeflag=true

@ifset:common
GetSizes

FWIW though, I think I agree with Leo... One unavoidable disadvantage with the method I've shown above is that if you have a single folder selected, <Ctrl+L> to get just it's size... then select another individual folder, and want just it's size - well, that second hotkey is still going to get sizes for ALL folders.

This example uses the new lister scoped variable that GPSoft added in v11, so it's effectively toggling whether or not it's going to get sizes for everything or just what's selected. Maybe more undesirable is that if you have NOTHING selected, the first press will get sizes for all folders (as designed). If you then switch to another folder path and select just one sub-folder, that second hotkey press will still get ALL folder sizes even though you had one selected... A consequence of using a variable as a toggle. You could layer some more stuff in there to avoid it maybe, like saving the current path in another var. But doing that'll will start looking fairly kludgey :slight_smile:.

That would make every second Ctrl+L push in the window deselect the folders first, but it wouldn't differentiate between quickly pushing Ctrl+L twice in a row, and pushing Ctrl+L, then doing other things for half an hour, then pushing Ctrl+L again. I think it'd end up being pretty confusing as it'd be difficult to predict what any push of Ctrl+L was going to do.

I guess you could do something with the new scripting support in Opus 11, where a script could save the time of the last Ctrl+L push into a variable, and then only change behaviour if the second push was within a few seconds of the first push. But I'd still say it's both better & easier to have two separate hotkeys, e.g. Ctrl+L and Ctrl+Shift+L, for the two behaviours, or to set up a Select None hotkey to push first when needed.

If I want to calculate sizes of all folders, I use Ctrl+A for Select All Items and then Ctrl+S for Calculate Sizes of Selected Items.
Note that Ctrl+S is non-standard shorcut. I'm not sure about Ctrl+A.

Thanks for all the suggestions! In the end I decided to keep default Opus 11 behavior for now and will make separate keyboard shortcuts if needed.

If you install Beta 3, you can try the following script button which I think will do what you want:

  • if any folders are selected, and their sizes have not previously been calculated, only the selected folders will be calculated
  • otherwise all folders will be calculated
<?xml version="1.0"?>
<button backcol="none" display="both" label_pos="right" textcol="none">
	<label>Smart GetSizes</label>
	<icon1>#default:getsizes</icon1>
	<function type="script">
		<instruction>@language vbscript</instruction>
		<instruction />
		<instruction>Function OnClick(ByRef ClickData)</instruction>
		<instruction>	fGetAll = True</instruction>
		<instruction>	for each file in ClickData.Func.Command.files</instruction>
		<instruction>		if file.is_dir and (not file.got_size) Then</instruction>
		<instruction>			fGetAll = False</instruction>
		<instruction>			exit for</instruction>
		<instruction>		end if</instruction>
		<instruction>	next</instruction>
		<instruction>	if fGetAll Then ClickData.Func.Command.ClearFiles</instruction>
		<instruction>	ClickData.Func.Command.deselect = False</instruction>
		<instruction>	ClickData.Func.Command.RunCommand &quot;GetSizes&quot;</instruction>
		<instruction>End Function</instruction>
	</function>
</button>

Great thanks jon! This is exactly the behavior I wanted (I've put the vbscript code in Ctrl+L keymap), and this also improves upon default Opus 10 behavior by never deselecting anything, I got best of both worlds :thumbsup:

Thanks Jon. This is an excellent script example. Worth posting in the Scripting Forum perhaps?

Regards, AB

Maybe - but I rather think it's good enough to be included as the default getsizes action shipped in v11... Not any downside in replacing the normal default with this that I can see, other than being more difficult to ~modify than the normal internal command if someone wanted to do so.

@Jon: is the @script vbcript statement at the beginning of this button even doing anything? I'm assuming that:

a. vbcript (missing the S) isn't a valid script language - lol - and,
b. the @script directive is only valid for the (now legacy) older rename script interface (and we can only use @language for v11 scripts)

...and that the button is working because you default to vbscript if it's not explicitly specified?

You're right, it's a typo - and vbscript is the default if not specified.